help for onetext

Title

onetext —— Help you do some simple Chinese text analysis.

Syntax

onetext varlist, [keyword:(string)]
method:[count/exist/cosine/jaccard]
generate:(real)

Description

onetext By entering your variable/variables, the onetext command
helps you to do some simple Chinese text analysis. It can simply count the
occurrence frequency of a specified Chinese character in Chinese text through
method(count), or observe whether it appears through method(exist).
When you have a vector of text, you can use method(cosine) and method(jaccard)
to calculate cosine similarity and jaccard similarity respectively.

Requirements

varlist(varname) specifies the variables. When you want to
observe whether Chinese words appear or count word frequencies, you are required
to specify the variable as text, and only one variable can be specified. When
you want to calculate cosine similarity or jaccard similarity, you need both
variables to be numerical types that can be calculated.

keyword(string) specify the Chinese characters you want to
look for, such as "大数据". Noting that this item is required when you need
to count words.

method(count/exist/cosine/jaccard) specifies the way you want
to use. Arguments other than the given characters are not allowed.

generate(varname) specifies a variable to save the result.

Examples1 - Find Chinese words.

.
`"clear"'

.
`"set obs 4"'

.
`"gen text = "大数据" in 1"'

.
`"replace text = "大数据大数据" in 2"'

.
`"replace text = "数据小数据" in 3"'

.
`"replace text = "小数据" in 4"'

.
`"onetext text, k("大数据") m(count) g(count_text) "'

Examples1 - Existence of Chinese words.

.
`"clear"'

.
`"set obs 4"'

.
`"gen text = "大数据" in 1"'

.
`"replace text = "大数据大数据" in 2"'

.
`"replace text = "数据小数据" in 3"'

.
`"replace text = "小数据" in 4"'

.
`"onetext text, k("大数据") m(exist) g(isExist) "'

Examples1 - Similarity calculation.

.
`"clear"'

.
`"set obs 3"'

.
`"gen var1 = 1 in 1"'

.
`"replace var1 = 2 in 2"'

.
`"replace var1 = 3 in 3"'

.
`"gen var2 = 4 in 1"'

.
`"replace var2 = 2 in 2"'

.
`"replace var2 = 5 in 3"'

.
`"onetext var1 var2, m(cosine) g(cs) "'

.
`"onetext var1 var2, m(jaccard) g(js) "'

Author

Shutter Zor(左祥太)

School of Accountancy, Wuhan Textile University.

E-mail: Shutter_Z@outlook.com.