zoukankan      html  css  js  c++  java
  • 综合练习:词频统计

    song='''
    We were both young when I first saw you
    I close my eyes and the flashback starts
    Love Story
    Love Story
    I'm standing there on a balcony in summer air
    See the lights see the party the ball gowns
    See you make your way through the crowd
    And say hello
    Little did I know
    That you were Romeo you were throwing pebbles
    And my daddy said stay away from Juliet
    And I was crying on the staircase
    Begging you please don't go
    And I said
    Romeo take me somewhere we can be alone
    I'll be waiting all there's left to do is run
    You'll be the prince and I'll be the princess
    It's a love story baby just say yes
    So I sneak out to the garden to see you
    We keep quiet cause we're dead if they knew
    So close your eyes
    Escape this town for a little while
    Cause you were Romeo, I was a scarlet letter
    And my daddy said stay away from Juliet
    But you were everything to me
    I was begging you please don't go
    And I said
    Romeo take me somewhere we can be alone
    I'll be waiting all there's left to do is run
    You'll be the prince and I'll be the princess
    It's a love story baby just say yes
    Romeo save me they're trying to tell me
    How to feel
    This love is difficult but it's real
    Don't be afraid we'll make it out of this mess
    It's a love story baby just say yes
    I got tired of waiting
    Wondering if you were ever coming around
    My faith in you was fading
    When I met you on the outskirts of town
    And I said
    Love Story
    Love Story
    Romeo save me I've been feeling so alone
    I keep waiting for you but you never come
    Is this in my head I don't know what to think
    He knelt to the ground and pulled out a ring
    And said
    Marry me Juliet never have to be alone
    I love you and that's all I really know
    I talked to your dad go pick out a white dress
    It's a love story baby just say yes
    Oh oh oh oh oh oh
    Cause we were both young when I first saw you
    '''
    symbol=[",",";",".","!","?","'",":","-"]
    words=['t','ve','s','ll']
    new_art=song
    for i in range(len(symbol)):
        new_art=new_art.replace(symbol[i],'')
    
    new_art=new_art.lower()
    art_list=new_art.split()
    
    dic = dict(zip())
    for i in art_list:
        dic[i] = new_art.count(i)

  • 相关阅读:
    20155339 Exp9 Web安全基础
    20155339 Exp8 Web基础
    20155339 Exp7 网络欺诈防范
    20155339 Exp6 信息搜集与漏洞扫描
    20155339 Exp5 MSF基础应用
    20155339 Exp4 恶意代码分析
    20155339 Exp3 免杀原理与实践
    20155339平措卓玛 Exp2 后门原理与实践
    20155339平措卓玛 Exp1 PC平台逆向破解(5)M
    20155339 第16周课堂实践加分作业
  • 原文地址:https://www.cnblogs.com/darkhate/p/8649685.html
Copyright © 2011-2022 走看看