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)

  • 相关阅读:
    C# 让程序自动以管理员身份运行
    [转]SAP算号器 license key Developer Access Key 完美解决方案
    【原创】项目性能优化全纪录(一) 存储过程优化
    treeview的遍历
    .NET求职笔试题目(续)
    SQL server 数据同步 Merge 的一个小bug
    use Stored procedure return a tabel(存储过程返回table)
    四种sql server 数据库分页的测试
    十五个世界最顶级的技术类博客网站
    层的拖动与隐藏
  • 原文地址:https://www.cnblogs.com/darkhate/p/8649685.html
Copyright © 2011-2022 走看看