Skip to main content

iKnow Natural Language Processing engine

Project description

iKnow

iKnow is a library for Natural Language Processing that identifies entities (phrases) and their semantic context in natural language text in English, German, Dutch, French, Spanish, Portuguese, Swedish, Russian, Ukrainian, Czech and Japanese. It was originally developed by i.Know in Belgium, acquired by InterSystems in 2010 to be embedded in its Caché and IRIS Data Platform products. InterSystems published the iKnow engine as open source in 2020.

Getting started with iKnow

This readme file has everything you need to get started, but make sure you click through to the wiki for more details on any of these subjects.

Using iKnow

From Python

The easiest way to see for yourself what iKnow does with text is by giving it a try! Thanks to our Python interface, that only takes two simple steps:

  1. Use pip to install the iknowpy module as follows:

    pip install iknowpy
    
  2. From your Python prompt, instantiate the engine and start indexing:

    import iknowpy
    
    engine = iknowpy.iKnowEngine()
    
    # show supported languages
    print(engine.get_languages_set())
    
    # index some text
    text = 'This is a test of the Python interface to the iKnow engine.'
    engine.index(text, 'en')
    
    # print the raw results
    print(engine.m_index)
    
    # or make it a little nicer
    for s in engine.m_index['sentences']:
        for e in s['entities']:
            print('<'+e['type']+'>'+e['index']+'</'+e['type']+'>', end=' ')
        print('\n')
    

If you are looking for another programming language or interface, check out the other APIs. For more on the Python interface, move on to the Getting Started section in the wiki!

From C++

The main C++ API file is engine.h, defining the class iKnowEngine with the main entry point:

index(TextSource, language)

After indexing all data is stored in iknowdata::Text_Source m_index. "iknowdata" is the namespace used for all classes that contain output data. Fore more details, please refer to the API overview on the wiki.

From InterSystems IRIS

For many years, the iKnow engine has been available as an embedded service on the InterSystems IRIS Data Platform. The obvious advantage of packaging it with a database is that indexing results from many documents can be stored in a single repository, enabling corpus-wide analytics through practical APIs. See the iKnow documentation for IRIS or browse the InterSystems Developer Community's articles on setting up an iKnow domain, browsing it and using iFind (iKnow-powered text search)

The InterSystems IRIS Community Edition is available from Docker Hub free of charge.

Understanding iKnow

Entities

iKnow identifies phrase boundaries that define Entities, entirely based on the syntactic structure of the sentences, rather than relying on an upfront dictionary or pretrained model. This makes iKnow well-suited for initial exploration of a new corpus. iKnow Entities are not Named Entities in the NER sense, but rather the word groups that need to be considered together, representing a concept or relationship as coined by the text author in its entirety. The following examples clearly show the importance of this phrase level to fully capture what the author meant:

iKnow Entity Meaning
Dopamine small molecule
Dopamine receptor drug target
Dopamine receptor antagonist chemical drug
Dopamine receptor gene gene, molecular sequence
Dopamine receptor gene mutation physiological process

iKnow will label every entity with a simple role that is either concept (usually corresponding to Noun Phrases in POS lingo) or relation (verbs, prepositions, ...). Typical stop words that have little meaning of their own get categorized as PathRelevant (e.g. pronouns) or NonRelevant parts, depending on whether they play a role in the sentence structure or are just linguistic fodder.

In the following sample sentence, we've highlighted concepts, relations and PathRelevants separately.

Belgian geuze is well-known across the continent for its delicate balance.

Read more...

Attributes

Beyond this simple phrase recognition, iKnow also captures the context of these entities through semantic attributes. Attributes label spans (of entities) within a sentence that share a semantic context. Most attributes start from a marker term and are then, through linguistic rules, expanded left and right as appropriate per the syntactic structure of the sentence. iKnow's main contribution is in this fine-grained expansion, which has been shown to be more accurate than many ML-based techniques.

iKnow supports the following attribute types:

  • Negation: iKnow tags all entities participating in a negation, as opposed to an (implied) affirmative context.

    After discussing his nausea, the [patient didn't report suffering from chest pain, shortness of breath or tickling].

  • Sentiment: based on a user-supplied list of marker terms, iKnow will identify spans with either a positive or negative sentiment (through separate attributes). Overlapping negation attributes will reverse the sentiment in some language models.

    [ I liked the striped pijamas], but the [slippers didn't really fit with it ].

  • Measurements, Time, Frequency and Duration: all entities "participating" in an expression of something measurable or time-related will be tagged, enabling efficient recognition of facts in long stretches of natural language text.

    Upon exam [two weeks ago] the [patient's weight was 146.5 pounds].

  • Certainty: this attribute is a work in progress. See the corresponding wiki section for more details.

Some attributes are not available for all languages yet. See the wiki section for more details.

How it works

Some InterSystems-era resources on how iKnow works:

Read more...

Building the iKnow Engine

The source code for the iKnow engine is written in C++ and includes .sln files for building with Microsoft Visual Studio 2019 Community Edition and Makefiles for building in Linux/Unix.

Please refer to this wiki page for more on the overall build process.

Contributing to iKnow

You are welcome to contribute to iKnow's engine code and language models. Check out the Wiki for more details on how they work and the Issues and Projects sections for any particular work on the horizon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-win_amd64.whl (28.2 MB view details)

Uploaded CPython 3.6mCPython 3.7mCPython 3.8CPython 3.9Windows x86-64

iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_ppc64le.whl (35.2 MB view details)

Uploaded CPython 3.6mCPython 3.7mCPython 3.8CPython 3.9

iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_aarch64.whl (31.4 MB view details)

Uploaded CPython 3.6mCPython 3.7mCPython 3.8CPython 3.9

iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2010_x86_64.whl (31.6 MB view details)

Uploaded CPython 3.6mCPython 3.7mCPython 3.8CPython 3.9manylinux: glibc 2.12+ x86-64

iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-macosx_10_9_x86_64.whl (28.2 MB view details)

Uploaded CPython 3.6mCPython 3.7mCPython 3.8CPython 3.9macOS 10.9+ x86-64

File details

Details for the file iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-win_amd64.whl.

File metadata

  • Download URL: iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-win_amd64.whl
  • Upload date:
  • Size: 28.2 MB
  • Tags: CPython 3.6m, CPython 3.7m, CPython 3.8, CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-win_amd64.whl
Algorithm Hash digest
SHA256 db563f0b594c3e6d46aa60b1fa3f246947d3f5d1df09db8e0e461b381143ddb0
MD5 5cfc22d56c193bfee18f8f7b9412beb8
BLAKE2b-256 f73c3d477d163ecbc1404a80d7f20fe5a1291525cf5a6bc6c72d83ebfa805028

See more details on using hashes here.

File details

Details for the file iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7a85ccf7bf59c340af670a8858491229cc940ff6378a73fc4c2c1e8f6df1bafa
MD5 9c28d7f1085e06ae9bbc6fa2411f54cf
BLAKE2b-256 357359a0a7380b4276d6f70f805454fd3374ed8af69c0c60f60812fdb71f9c0b

See more details on using hashes here.

File details

Details for the file iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1128436ca8f5ce32c9958d0a9eb3c701e2638af413cd5fadbb87b0a74d4d56b8
MD5 8a757c87a777b8db333059662c355ed6
BLAKE2b-256 542827c0bdd00bc5c8de37aa90538f6dc008fd88777f3be75f72b657a08ba6bb

See more details on using hashes here.

File details

Details for the file iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 83500de02a678e1b5ece8c9c43e98bde1b4c93c253384ac7085078df9081437a
MD5 91ec6e75a09df6b99958354b3c6bafa1
BLAKE2b-256 fff72255df003d968e8b38333563f5f15d694f43ea8a13544b17d668aebdeae5

See more details on using hashes here.

File details

Details for the file iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for iknowpy-1.0.11-cp36.cp37.cp38.cp39-cp36m.cp37m.cp38.cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 52fbf4785ec1e31655bbbeb90cf2cb140006b051068b62d266e191d9025d4bd7
MD5 d3ece82a09113a5990361f02eba72a79
BLAKE2b-256 7744c0fc0aa784592bde64cbdef14d22e90119a79084e4ff8e4f2825f5583afa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page