>只返回发生大于X的字
>只返回长度大于Y的字
>忽略常用术语,如“和,是,等等”
>在处理之前,请随意删除标点符号(即“约翰的”成为“约翰”)
>返回结果集合/数组
额外信用
>将引用的声明保持在一起(即“显然”他们太好了,不能真实地实现“)”真的太好了“将是实际的声明
额外信用
>您的脚本可以根据被发现的频率确定应该保持在一起的单词吗?这是在事先知道的情况下完成的.例:
*”The fruit fly is a great thing when it comes to medical research. Much study has been done on the fruit fly in the past,and has lead to many breakthroughs. In the future,the fruit fly will continue to be studied,but our methods may change.”*
显然这里的词是“果蝇”,这对我们来说很容易找到.你的search’n’scrape脚本可以确定吗?
来源文字:http://sampsonresume.com/labs/c.txt
回答格式
除了操作持续多长时间之外,看到你的代码,输出结果会很好.
解决方法
sed -e 's/ /\n/g' | grep -v '^ *$' | sort | uniq -c | sort -nr
结果:
7 be 6 to [...] 1 2. 1 -
发生大于X:
sed -e 's/ /\n/g' | grep -v '^ *$' | sort | uniq -c | awk '$1>X'
只返回长度大于Y的字(在第二个grep中放Y点):
sed -e 's/ /\n/g' | grep -v '^ *$' | grep .... | sort | uniq -c
忽略常见的术语,如“and,is,the等”(假设通用术语在文件中被忽略)
sed -e 's/ /\n/g' | grep -v '^ *$' | grep -vf ignored | sort | uniq -c
在处理之前,请随意删除标点符号(即“约翰的”成为“约翰”):
sed -e 's/[,.:"\']//g;s/ /\n/g' | grep -v '^ *$' | sort | uniq -c
返回结果集合/数组:它已经像shell的一个数组:第一列是count,second是word.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。