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)

  • 相关阅读:
    Linux 配置 SSL 证书
    freemarker 异常处理
    StringTemplateLoader的用法
    序列的重点知识小结
    Linux下安装lrzsz上传下载工具
    ajax技术
    Response对象介绍(服务器到客户端)
    Request对象介绍(客户端到服务器)
    JSP--内置对象&动作标签介绍
    JSP--常用指令
  • 原文地址:https://www.cnblogs.com/darkhate/p/8649685.html
Copyright © 2011-2022 走看看