Skip to main content


Project description



Agreementr is a package used to predict the value of agreement of texts.

It is based on a fine tuned BERT model.


Use pip

If pip is installed, agreementr could be installed directly from it:

pip install agreementr



Usage and Example

Notes: During your first usage, the package will download a model file automatically, which is about 400MB.


predict is the core method of this package, which takes a single text of a list of texts, and returns a list of raw values in [1,5] (higher means more agreement, while lower means less).

Simplest usage

You may directly import agreementr and use the default predict method, e.g.:

>>> import agreementr
>>> agreementr.predict(["I am totally agree with you"])

Construct from class

Alternatively, you may also construct the object from class, where you could customize the model path and device:

>>> from agreementr import Agreementr
>>> ar = Agreementr()

# Predict a single text
>>> ar.predict(["I am totally agree with you"])

# Predict a list of texts
>>> preds = ar.predict(['I am totally agree with you','I hate you'])
>>> f"Raw values are {preds}"
[4.3568916 2.42935]

More detail on how to construct the object is available in docstrings.

Model using multiprocessing when preprocessing a large dataset into BERT input features

If you want to use several cpu cores via multiprocessing while preprocessing a large dataset, you may construct the object via

>>> ar = Agreementr(CPU_COUNT=cpu_cpunt, CHUNKSIZE=chunksize)

If you want to faster the code through multi gpus, you may construct the object via

>>> ar = Agreementr(is_paralleled=False, BATCH_SIZE = batch_size)


Junjie Wu (

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

agreementr-1.5.tar.gz (7.6 kB view hashes)

Uploaded source

Built Distribution

agreementr-1.5-py3-none-any.whl (10.3 kB view hashes)

Uploaded py3

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