word2ind

地图字编码索引

描述

中号= word2ind(ENC返回的索引在编码ENC

例子

全部收缩

加载的示例数据。文件sonnetsPreprocessed.txt包含莎士比亚十四行诗的预处理版本。该文件包含每行一个十四行诗,文字分离通过的空间。提取文本sonnetsPreprocessed.txt,拆分文本的换行符的文件,然后记号化文档。

文件名=“sonnetsPreprocessed.txt”;STR = extractFileText(文件名);的TextData = SPLIT(STR,换行);文档= tokenizedDocument(的TextData);文件(1:​​10)
ANS = 10×tokenizedDocument:70个令牌:最美丽的生物欲望,从而增加beautys上涨可能feedst你的灯火焰selfsubstantial燃料制造饥荒丰富的谎言你自己你的敌人,你的甜蜜自我残酷永远不死比较成熟的时候去世招标继承人可能承担存储你染上你自己明亮的眼睛你是世界清新的点缀,预示着锦绣阳春你自己的芽buriest你的内容温柔吝啬鬼makst浪费吝啬可惜世界上其他馋嘴吃,由于严重你71令牌世界:四十个冬天围攻你的朱颜深挖战壕你beautys场你的青少年自豪制服注视tatterd杂草持有的小值得问你的美丽谎言珍惜你那少壮年华说你自己的深眼窝深陷alleating耻辱无益的颂扬赞美deservd你beautys你couldst答案公平儿童地雷应计算数目使得老借口证明美继承你新做你年纪老迈了你的血液温暖你feelst冷65令牌:看看你的玻璃告诉你的脸时viewest面对另一种形式,其FRESh修复你重就欺骗世界unbless母亲公平,其uneard子宫不屑耕作你牧喜欢墓selflove停止后人你是,尽管皱纹你的黄金时间你活着rememberd你母亲玻璃你身上唤回了可爱的四月黄金你的窗户祢年龄必死单祢图像模具你71个令牌:unthrifty可爱为什么把你花费在你的自我你beautys遗产性质遗赠给什么岂是借坦诚借给释放媄吝啬你干嘛要滥用厚礼你给予赔本的高利贷者为什么把你伟大的总和数额尚未情思实时路况你自我独自你你自己你的甜蜜自等于欺骗性质叫你走了接受审计阴间,你还能让你的未使用的美容tombed你住日执行61个令牌:小时温柔的工作框架可爱的凝视每眼岂是停留相当玩霸同样不公平这话的Excel neverresting时间线索夏冬狰狞SAP混淆检查霜精力充沛的叶子挺过去了美容oersnowed barenesŝ每个夏天蒸馏留下液体囚犯被压抑的墙壁玻璃beautys影响美容丧失,也不也不distilld虽然冬天相遇利斯秀物质仍然生活甜蜜68个标记的纪念花:让冬天嶙峋的手抹掉你你的夏天趁着你distilld使甜小瓶珍惜你的地方beautys宝ERE selfkilld禁止利息人们高兴支付愿意贷款这就是你的自我生出另一个你高兴十倍十十次你自己更快乐你是10个祢十倍refigurd你死你总不该启程离开你的生活后人selfwilld你的艺术博览会死亡征服蛆虫做你的后嗣64 tokens: lo orient gracious light lifts up burning head eye doth homage newappearing sight serving looks sacred majesty climbd steepup heavenly hill resembling strong youth middle age yet mortal looks adore beauty still attending golden pilgrimage highmost pitch weary car like feeble age reeleth day eyes fore duteous converted low tract look another way thou thyself outgoing thy noon unlookd diest unless thou get son 70 tokens: music hear why hearst thou music sadly sweets sweets war joy delights joy why lovst thou thou receivst gladly else receivst pleasure thine annoy true concord welltuned sounds unions married offend thine ear sweetly chide thee confounds singleness parts thou shouldst bear mark string sweet husband another strikes mutual ordering resembling sire child happy mother pleasing note sing whose speechless song many seeming sings thee thou single wilt prove none 70 tokens: fear wet widows eye thou consumst thy self single life ah thou issueless shalt hap die world wail thee like makeless wife world thy widow still weep thou form thee hast left behind every private widow well keep childrens eyes husbands shape mind look unthrift world doth spend shifts place still world enjoys beautys waste hath world end kept unused user destroys love toward others bosom sits murdrous shame commits 69 tokens: shame deny thou bearst love thy self art unprovident grant thou wilt thou art belovd many thou none lovst evident thou art possessd murderous hate gainst thy self thou stickst conspire seeking beauteous roof ruinate repair thy chief desire o change thy thought change mind shall hate fairer lodgd gentle love thy presence gracious kind thyself least kindhearted prove make thee another self love beauty still live thine thee

创建一个字编码。

ENC = wordEncoding(文档)
ENC = wordEncoding与属性:NUMWORDS:3092词汇:[1x3092字符串]

地图中的“玫瑰”,“爱”和“美”编码指数使用word2ind功能。

词语= [“玫瑰”“爱”“美”]。IDX = word2ind(ENC,字)
IDX =1×37 387 79

输入参数

全部收缩

输入字编码,指定为wordEncoding目的。

输入字,指定为字符串向量,特征向量,或字符向量的单元阵列。如果您指定为字符向量,则该函数将参数作为一个单词。

数据类型:|烧焦|细胞

输出参数

全部收缩

字编码指数的载体。

介绍了在R2018b