Icon

Partager Envoyer

(Document)

Overview of Oonai

Oonai was first conceived as an extension to the chora data manager layer.

Nevertheless, it can be used as a standalone software to provide helpful services for text analysis/classification through http(s) for your own applications.

Feed Oonai with some text and it will allow you to:

  1. analyse, tag and extract entities from a text (analyze)
  2. retrieve definitions of concepts, persons, places (describe)
  3. understand the intent behind a question (nlu)
  4. classify a document (by returning the id of a suitable collection) (classify),
  5. detect the datatype of a document (by returning the id of a suitable datatype) (datatype),
  6. look for a similar document in a collection (specified by its id) (similar),
  7. detect the language of text (language),
  8. translate text into another language (translate),
  9. receive vocal commands, read answers aloud or return a written answer (listen/input, say)
  10. compute the distance between places or words (haversine, levenshtein, jaro)
  11. convert between various units, including currencies at the latest rate (convert, currency)
  12. roll dices
  13. and many other cool things, like searching a dictionnary, an encyclopedia, finding a location, predicting weather or querying a llm...

In order to achieve its purpose, Oonai relies on some popular packages such as: TextBlob (Naive Bayes Algorithm), spaCy (Neural Network Architecture, see https://spacy.io/api/#nn-models), the Natural Language ToolkitStanford CoreNLP or the amazing dbacl project (a digramic Bayesian classifier).

Some of Oonai functions require temporary data files (for audio output, text samples and models) and will consume disk space: Some of these files can be generated from chora by loading the collections/setup_servetext method. This will generate the dictionaries of your collections and datatypes (preferably without stop words).

Oonai services can be accessed through http (or https if you provide certificate files) with a very simple API reminiscent of RESTful:
—The parameters are passed with GET/POST and should be properly url encoded.
—The responses are returned in JSON.

Set up your environment (quick instructions)

It is usually easier to install Oonai on the same system that hosts chora or your own web application: if you want to use another host, like some dedicated hardware (such as a Nvidia Jetson Nano), you'll need to synchronize collections/data files generated from chora into oonai's installation directory: this may be accomplished through SSH, rsync or FTP, for instance: we can provide such tools. Of course, if you plan to use Oonai as a standalone software, you'll need to generate some files by your own means (have a look at the provided samples to see how your data must be formatted...)

Install Python 3.6+ with support for sqlite3, pyaudio and pocketsphinx.

For instance, on a FreeBSD System you may use:

pkg inst python36 py36-sqlite3 py36-pyaudio pocketsphinx

For installing the rest of dependencies, you'll need pip (more precisely, pip3 for Python 3.x).

python3 -m pip install -r requirements.txt

Note: OonaI runs as a http service: web.py 0.40.dev1 or latest for Python 3 will be installed.

Download, Compile and install the binaries of the dbacl project --see included Documentation
Generate the appropriate datafiles from chora by loading:
http://path/to/chora/collections/setup_servetext in your browser

For detailed instructions, check the included README file.

Start Oonai

Start oonai in a terminal with:
    /usr/local/www/webapp/binaries/servetext/servetext.py 8880 (Use fullpath!)
or as a detached process that will run in background with:
    /usr/local/www/webapp/binaries/servetext/start_servetext.sh

To detach oonai from the terminal, you may also use screen:
    screen /usr/local/www/webapp/binaries/servetext/servetext.py 8880 &

Use Oonai

This is actually as simple as pointing your browser to the appropriate url in order to call one of the available methods.
Here are some examples:

  1. /analyze/some text to analyze for named entities
  2. /language/some string to detect language
  3. /translate/{language code}/text to translate to target language
  4. /classify/some string to classify by finding the most suitable collection...
  5. /datatype/some string to classify by finding the most appropriate datatype...
  6. ...

For a comprehensive list of Oonai functions, read the Oonai functions document.

Stop Oonai

Simply kill Oonai Parent Process (retrieve its PID with pgrep -n -f servetext.py) or run the provided script:
    /usr/local/www/webapp/binaries/servetext/stop_servetext.sh


Ce document a été publié le 2019-07-18 12:18:39. (Dernière mise à jour : 2024-05-22 10:46:21.)

À lire ensuite 1




This website uses 'cookies' to enhance user experience and provide authentification. You may change which cookies are set at any time by clicking on more info. Accept
x