Skip to main content

A python implementation of IAMsystem algorithm

Project description

iamsystem

test Linux PyPI version fury.io PyPI license PyPI pyversions Code style: black

A python implementation of IAMsystem algorithm, a fast dictionary-based approach for semantic annotation, a.k.a entity linking.

Installation

pip install iamsystem

Usage

You provide a list of keywords you want to detect in a document, you can add and combine abbreviations, normalization methods (lemmatization, stemming) and approximate string matching algorithms, IAMsystem algorithm performs the semantic annotation.

See the documentation for the configuration details.

Quick example

from iamsystem import Matcher

matcher = Matcher.build(
    keywords=["North America", "South America"],
    stopwords=["and"],
    abbreviations=[("amer", "America")],
    spellwise=[dict(measure="Levenshtein", max_distance=1)],
    w=2,
)
annots = matcher.annot_text(text="Northh and south Amer.")
for annot in annots:
    print(annot)
# Northh Amer	0 6;17 21	North America
# south Amer	11 21	South America

Algorithm

The algorithm was developed in the context of a PhD thesis. It proposes a solution to quickly annotate documents using a large dictionary (> 300K keywords) and fuzzy matching algorithms. No string distance algorithm is implemented in this package, it imports and leverages external libraries like spellwise, pysimstring and nltk. Its algorithmic complexity is O(n(log(m))) with n the number of tokens in a document and m the size of the dictionary. The formalization of the algorithm is available in this paper.

The algorithm was initially developed in Java (https://github.com/scossin/IAMsystem). It has participated in several semantic annotation competitions in the medical field where it has obtained satisfactory results, for example by obtaining the best results in the Codiesp shared task. A dictionary-based model can achieve close performance to a transformer-based model when the task is simple or when the training set is small. Its main advantage is its speed, which allows a baseline to be generated quickly.

Citation

@article{cossin_iam_2018,
	title = {{IAM} at {CLEF} {eHealth} 2018: {Concept} {Annotation} and {Coding} in {French} {Death} {Certificates}},
	shorttitle = {{IAM} at {CLEF} {eHealth} 2018},
	url = {http://arxiv.org/abs/1807.03674},
	urldate = {2018-07-11},
	journal = {arXiv:1807.03674 [cs]},
	author = {Cossin, Sébastien and Jouhet, Vianney and Mougin, Fleur and Diallo, Gayo and Thiessard, Frantz},
	month = jul,
	year = {2018},
	note = {arXiv: 1807.03674},
	keywords = {Computer Science - Computation and Language},
}

Project details


Download files

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

Source Distribution

iamsystem-0.4.0.tar.gz (65.7 kB view details)

Uploaded Source

Built Distribution

iamsystem-0.4.0-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file iamsystem-0.4.0.tar.gz.

File metadata

  • Download URL: iamsystem-0.4.0.tar.gz
  • Upload date:
  • Size: 65.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.7

File hashes

Hashes for iamsystem-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f5028a2fdc95ae1118620e1444ecc3e55545e1caecfedb7c3f6978c4be1a49c5
MD5 68789c143f8f27a59813b411f745ebe1
BLAKE2b-256 193a09a1b7893f8b873c7d0225e06b4fd485586e6f4bd067f56bd33da34deb35

See more details on using hashes here.

File details

Details for the file iamsystem-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: iamsystem-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 56.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.7

File hashes

Hashes for iamsystem-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5923ac5469ba20fc7c3e3ef7c18eab3f75b5ec37b9226f9d7f3f4389b258a2e1
MD5 af56555a741346092a4c73d8eae5c662
BLAKE2b-256 4af5ae925b348de4e870bff81a74a62f24b00c4639d3b0dec1292649d4e9352b

See more details on using hashes here.

Supported by

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