第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

打印使用 gensim 學習的二元組

打印使用 gensim 學習的二元組

翻閱古今 2021-09-11 17:50:52
我想使用 gensim 從語料庫中學習 bigrams,然后打印學習到的 bigrams。我還沒有看到這樣做的例子。幫助贊賞from gensim.models import Phrasesdocuments = ["the mayor of new york was there", "human computer interaction and machine learning has now become a trending research area","human computer interaction is interesting","human computer interaction is a pretty interesting subject", "human computer interaction is a great and new subject", "machine learning can be useful sometimes","new york mayor was present", "I love machine learning because it is a new subject area", "human computer interaction helps people to get user friendly applications"]sentence_stream = [doc.split(" ") for doc in documents]bigram = Phrases(sentence_stream)# how can I print all bigrams learned and just the bigrams, including "new_york" and "human computer" ?enter code here
查看完整描述

2 回答

?
慕桂英546537

TA貢獻1848條經驗 獲得超10個贊

import operator

sorted(

    {k:v for k,v in bigram.vocab.items() if b'_' in k if v>=bigram.min_count}.items(),

    key=operator.itemgetter(1),

    reverse=True)


查看完整回答
反對 回復 2021-09-11
  • 2 回答
  • 0 關注
  • 187 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號