16.5 aztext analyze

20210612 The analyze command performs a basic analysis across the four capabilities (language, sentiment, entities, and phrases).

$ ml analyze aztext [<sentence>]

conf,lang,sentiment,phrases,etities

The command takes a single sentence and returns the text analysis of the sentence, beginning with the confidence of the identification of the language, the language code, the sentiment (0 to 1 as negative to positive), the key phrases identified separated by colons, and the identified entities also separated by colons.

$ ml analyze aztext I had a wonderful experience! The rooms were wonderful and staff helpful.
1.0,en,0.96,wonderful experience:rooms:staff helpful,

$ ml analyze aztext I had a trip to Singapore and enjoyed seeing the Botanic Gardens
1.0,en,0.92,Singapore:Botanic Gardens:trip,Location=Singapore:Location=Singapore Botanic Gardens

$ ml analyze aztext Los caminos que llevan hasta Monte Rainier son espectaculares y
1.0,es,0.55,Monte Rainier:caminos,Location=Monte Rainier

$ ml analyze aztext La carretera estaba atascada. Había mucho tráfico el día de ayer.
1.0,es,0.33,carretera:tráfico:día,

$ ml analyze aztext  这是一个用中文写的文件
1.0,zh_chs,0.75,,

$ ml analyze aztext Các bãi biển trên Phú Quốc là tuyệt vời.
1.0,vi,,,

Note that sentiments, key phrases, and entities are not supported for all languages. Refer to the supported command.

The analyze command will also work without an argument whereby it will read text from standard input if it is part of a pipeline.

$ cat sample.txt
They’re annoying the hell out of people.
Pour le logiciel libre, la liberté a un prix et un modèle économique
I just toured Ecuador and Peru and came back addicted to plantains.

$ cat sample.txt | ml analyze aztext
1.0,en,0.06,hell:people,
1.0,fr,1.00,liberté:prix:logiciel libre:modèle économique,DateTime=a un:Quantity=et un
1.0,en,0.70,Peru:toured Ecuador:plantains,Location=Ecuador:Location=Peru

If the analyze command is not part of a pipeline then it will enter an interactive loop, prompting for a sentence, and analyzing that sentence.

$ ml analyze aztext
Enter text to be analysed. Quit with Empty or Ctrl-d.
(Output: conf,lang,sentiment,phrases,entities):

> La primera vez que escucho semejante palabra
1.0,es,0.52,semejante palabra,Quantity=primera

> I have returned to this country Australia to live in Melbourne
1.0,en,0.50,country Australia:Melbourne,Location=Australia:Location=Melbourne

>

Type Ctrl-D to finish.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.