9.7 将字符串拆分为单词序列
将字符串拆分为单词序列。
统计某篇文章中出现频率前三名的单词。文章部分内容如下:
How to Call an SPL Script in Java
esProc provides its own JDBC driver to become integration-friendly with a Java application. The method of calling an esProc SPL script is similar to the execution of SQL queries and stored procedures in Java.
Deploying esProc JDBC in a Java application
Simply put, to deploy JDBC in a Java application is to put in place the necessary jars and configuration files for loading esProc when starting the application. esProc JDBC requires JDK 1.6 or a higher version.
…
使用函数 A.words() 拆分出字符串中的英文单词。
脚本:
A | |
---|---|
1 | =file(“callSPL.txt”).read() |
2 | =A1.words() |
3 | =A2.group() |
4 | =A3.ptop(-3;~.len()) |
5 | =A3(A4).(~(1)).concat@c() |
A1 从文件中读取字符串
A2 使用 A.words() 函数拆分出字符串中的英文单词
A3 将单词分组
A4 选出出现频率前三名的单词
A5 将前三名的单词用逗号连接成字符串
运行结果:
Value |
---|
the,property,name |