如何在一长串字符中找到正确的单词?
Input :
"The revised report onthesyntactictheoriesofsequentialcontrolandstate"
谷歌的输出:
"The revised report on syntactic theories sequential controlandstate"
(考虑到他们产生输出的时间,这已经足够接近了)
您认为谷歌是如何做到的?
您将如何提高准确性?
我会尝试这样的递归算法:
- 尝试在每个位置插入一个空格。如果左侧部分是单词,则在右侧部分重复。
- 统计所有最终输出中的有效单词数/总单词数。比例最佳的可能就是您的答案。
例如,给它“thesentenceisgood”将运行:
thesentenceisgood
the sentenceisgood
sent enceisgood
enceisgood: OUT1: the sent enceisgood, 2/3
sentence isgood
is good
go od: OUT2: the sentence is go od, 4/5
is good: OUT3: the sentence is good, 4/4
sentenceisgood: OUT4: the sentenceisgood, 1/2
these ntenceisgood
ntenceisgood: OUT5: these ntenceisgood, 1/2
所以你会选择 OUT3 作为答案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)