Skip to main content

Wowool SDK

Project description

The Wowool NLP Toolkit

install

Install the main sdk.

pip install wowool-sdk

Installing languages.

pip install wowool-[language]

Quick Start

Just create a document and pipeline, pass your document trough the Pipeline, and your done.

from wowool.sdk import Pipeline
from wowool.document import Document

document = Document("Mark Van Den Berg works at Omega Pharma.")
# Create an analyzer for a given language and options
process = Pipeline("english,entity")
# Process the data
document = process(document)
print(document)

API

Examples

You will need to install the english language module to run the sample. pip install wowool-english

Create a pipeline.

This script demonstrates how to use the UID component to create a pipeline.

from wowool.sdk import Pipeline
from wowool.common.pipeline import UID

process = Pipeline(
    [
        UID("english", options={"anaphora": False}),
        UID("entity"),
        UID("topics.app", {"count": 3}),
    ]
)
document = process("Mark Janssens works at Omega Pharma.")
print(document)

Custom domain

The script identifies the word "car" as a Vehicle entity in the sentence "I have a car." using custom domain rules and language processing.

For more info on how to write rules see: https://www.wowool.com/docs/nlp/matching-&-capturing

from wowool.sdk import Language, Domain
from wowool.document import Document

english = Language("english")
vehicle = Domain(source="rule:{ 'car'} = Vehicle;")
doc = vehicle(english(Document("I have a car.")))
for entity in doc.entities:
    print(entity)

Using the language identifier

This script demonstrates how to use the LanguageIdentifier to detect the language of a document.

from wowool.sdk import LanguageIdentifier

document = """
Un été de tous les records de chaleur en France.
Record de chaleur battu dans une cinquantaine de villes en France

"""
# Initialize a language identification engine
lid = LanguageIdentifier()
# Process the data
doc = lid(document)
print(doc.language)

Extract dutch entities

This script demonstrates how to perform basic entity analysis on a Dutch sentence using the Wowool SDK.

Install first the dutch language model pip install wowool-dutch

from wowool.sdk import Pipeline
from wowool.document import Document

entities = Pipeline("dutch,entity")
document = entities(Document("Mark Van Den Berg werkte als hoofdarts bij Omega Pharma."))
for sentence in document.sentences:
    for entity in sentence.entities:
        print(entity)

Using the language identifier

This script demonstrates how to use the LanguageIdentifier to detect the different language sections in a text multi-language document.

from wowool.sdk import LanguageIdentifier

document = """
La juventud no es más que un estado de ánimo.

Record de chaleur battu dans une cinquantaine de villes en France

"""
# Initialize a language identification engine
lid = LanguageIdentifier(sections=True, section_data=True)
# Process the data
doc = lid(document)
if lid_results := doc.lid:
    for section in doc.lid.sections:
        assert section.text
        print(f"({section.begin_offset},{section.end_offset}): language= {section.language} text={section.text[:20].strip('\n')}...")

License

In both cases you will need to acquirer a license file at https://www.wowool.com

Non-Commercial

This library is licensed under the GNU AGPLv3 for non-commercial use.  
For commercial use, a separate license must be purchased.  

Commercial license Terms

1. Grants the right to use this library in proprietary software.  
2. Requires a valid license key  
3. Redistribution in SaaS requires a commercial license.  

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 Distribution

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

nlp_wowool_sdk-3.6.1-py3-none-any.whl (67.6 kB view details)

Uploaded Python 3

File details

Details for the file nlp_wowool_sdk-3.6.1-py3-none-any.whl.

File metadata

  • Download URL: nlp_wowool_sdk-3.6.1-py3-none-any.whl
  • Upload date:
  • Size: 67.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for nlp_wowool_sdk-3.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63c8bfcfd7713e7efba89d574c4085b2dbd8dc21ae1f95b3287dc1c9b37b00ef
MD5 5b4a53fcd70aec142e450695a72bfde1
BLAKE2b-256 a04e66d903d91e404bb96b7602002e879128d080204e418923d0d2306283dd36

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