主要内容

ind2word

将编码索引映射到word

描述

例子

= ind2word (enc,M)返回与中的编码索引对应的单词M根据单词编码enc.

例子

全部崩溃

加载示例数据。档案十四行诗预处理.txt包含莎士比亚十四行诗的预处理版本。该文件每行包含一首十四行诗,单词之间用空格分隔。从中提取文本十四行诗预处理.txt,以换行符将文本拆分为文档,然后标记文档。

文件名=“十四行诗预处理.txt”; str=提取文件文本(文件名);textData=拆分(str,换行);文档=标记化文档(textData);文件(1:10)
ans = 10x1 tokenizedDocument: 70 token:美丽的生物欲望增加从而美丽玫瑰可能永远不会死成熟时间流逝的记忆交给娇嫩的后嗣收缩你的明亮的眼睛feedst你灯火焰selfsubstantial燃料使饥荒丰富是你自我你的敌人你甜蜜的自我残酷的艺术世界新鲜点缀春天华丽使者你自己的花蕾埋葬你知足的温柔的粗鲁的人浪费了吝啬的怜悯,否则贪婪的吃了世界应有的坟墓,你的71个记号:四十冬天围攻你的眉毛挖深沟你的美容领域你年轻人骄傲制服盯着tatterd杂草小值得问你的美丽谎言珍惜你说你自己的深凹的眼睛的日夜alleating羞愧浪费的赞美赞美deservd你的美丽你能够回答我公平的孩子应当和计数使老借口证明美丽继承你的新,你的旧,你的血液温暖,你的感觉寒冷,看你的玻璃告诉脸你查看时间脸形成另一个新鲜的修复17你欺骗世博会unbless母亲的子宫uneard不屑走旁人走过耕作你饲养喜欢墓selflove停止后人你是你母亲的玻璃你电话回可爱的4月最佳窗口你年龄要尽管皱纹你的黄金时间活着,记住,独自死去,你的形象死去,你的象征。unthrifty可爱为什么你花在你的自我你美丽遗产性质遗赠给了什么难道借弗兰克借自由美丽的吝啬鬼为什么你虐待你慷慨的慷慨给无益的高利贷者为什么你伟大的金额总和还能实时路况你自我孤独你自我你甜蜜的自我欺骗内急你消失了你能把你那未用过的美留在坟墓里吗?小时温柔的工作框架可爱的眼睛凝视每个难道住打暴君一样不公平很难道excel neverresting时间导致夏天可怕的冬天混淆sap检查霜精力充沛的叶子很美丽了oersnowed赤裸每个夏天蒸馏液体离开囚禁囚犯墙玻璃美容效果美丽失去也没有鲜花和纪念 distilld though winter meet leese show substance still lives sweet 68 tokens: let winters ragged hand deface thee thy summer ere thou distilld make sweet vial treasure thou place beautys treasure ere selfkilld forbidden usury happies pay willing loan thats thy self breed another thee ten times happier ten ten times thy self happier thou art ten thine ten times refigurd thee death thou shouldst depart leaving thee living posterity selfwilld thou art fair deaths conquest make worms thine heir 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=文字编码(文档)
enc = wordEncoding with properties: NumWords: 3092 Vocabulary: [1x3092 string]

查看索引1、3和5对应的单词ind2word功能。

idx=[1 3 5];words=ind2word(enc,idx)
言语=1 x3字符串“公平”、“愿望”、“因此”

输入参数

全部崩溃

输入字编码,指定为文字编码对象。

字编码索引,指定为正整数向量。

输出参数

全部崩溃

输出字,作为字符串向量返回。

在R2018b中引入