这个想法很简单:将文本放入文本区域,按“发送”并返回重复短语的列表。我所说的短语是指重复两个或多个单词。我的问题是我不知道如何检测这些(我只能说出一个字)。
$(function() {
$("#but").click(function() {
var get = $("#inc").val();
$("#res").html(get);
return false;
});
});
和 HTML:
<form action="" method="POST">
<textarea name="inc" id="inc" spellcheck="false"></textarea> <br>
<input type="submit" id="but" value="Send">
</form>
<div id="res"></div>
问题当然是我什至不知道从哪里开始。有什么想法吗?
例子:
Paris s the capital and most populous city of France. Paris and the Paris region account for more than 30% of the gross domestic product of France and have one of the largest city GDPs in the world.
最佳答案
检查 http://brettterpstra.com/2011/11/02/word-repetition-checking-with-javascript/ 这可能对您尝试做的事情非常有帮助。因为问题不是那么简单。最好看看这篇博文以及给出的解决方案。 它实际上是一个单词重复脚本。
关于javascript创建一个包含文本中重复短语的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16628838/