Skip to content

Getting Started

Benjamin De Boe edited this page Jun 17, 2020 · 11 revisions

The iknowpy module brings the iKnow engine capabilities to Python ≥3.5 and is currently supported on Windows, Mac OS, and Linux.

Python Quickstart

To start working with iKnow from Python, just pip-install the iknowpy module as follows:

pip install iknowpy

The Python Interface

The iknowpy wrapper module provides a [Python interface|] to the iKnow engine. It defines the class "iKnowEngine" and its main method, iKnowEngine.index(). After indexing, all data is stored in the m_index property, represented as nested dictionaries and lists.

  • m_index['sentences'] : a list of sentences in the text source after indexing.
  • m_index['sentences'][i] : the ith sentence in the text source after indexing.
  • m_index['sentences'][i]['entities'] : a list of text entities in the ith sentence after indexing.
  • m_index['sentences'][i]['path'] : a list representing the path in the ith sentence.
  • m_index['sentences'][i]['path_attributes'] : a list of spans in the ith sentence's path after attribute expansion.
  • m_index['sentences'][i]['sent_attributes'] : a list of attribute sentence markers for the ith sentence.
  • m_index['proximity'] : the proximity pairs in the text source after indexing.

See <repo_root>/modules/iknowpy/tests/test.py for a basic example of how to use the module.

Availability

To install a pre-built release of iknowpy, execute pip install iknowpy (pip3 install iknowpy on some platforms). Installation via pip is supported for CPython 3.5 through CPython 3.8 on the following platforms.

  • Windows for x86_64
  • Mac OS X 10.9 or higher for x86_64
  • Linux for x86_64 (pip ≥19.0 is required)
  • Linux for i686 (pip ≥19.0 is required)
  • Linux for ppc64le (pip ≥19.3 is required)
  • Linux for aarch64 (pip ≥19.3 is required)

Linux releases for x86_64 and i686 are compatible with the vast majority of modern distributions that are no older than CentOS 6. Linux releases for ppc64le and aarch64 are compatible with the vast majority of modern distributions that are no older than CentOS 7.

Building from source

For more on building the iknowpy module and the underlying libraries, see this section.