Question-Intimacy
Intro
question-intimacy is a package used to estimate the intimacy of questions. It is released with
EMNLP 2020 paper Quantifying Intimacy in Language.
Install
Use pip
If pip is installed, question-intimacy could be installed directly from it:
pip3 install question-intimacy
Dependencies
python>=3.6.0
torch>=1.6.0
transformers >= 3.1.0
numpy
math
tqdm
Usage and Example
Notes: During your first usage, the package will download a model file automatically, which is about 500MB.
Construct the Predictor Object
>>> from question_intimacy.predict_intimacy import IntimacyEstimator
>>> inti = IntimacyEstimator()
Cuda is disabled by default, to allow GPU calculation, please use
>>> from question_intimacy.predict_intimacy import IntimacyEstimator
>>> inti = IntimacyEstimator(cuda=True)
predict
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,1] (higher means more intimate, while lower means less).
# Predict intimacy for one question
>>> text = 'What is this movie ?''
>>> inti.predict(text,type='list')
-0.2737383
# Predict intimacy for a list of questions (less than a batch)
>>> text = ['What is this movie ?','Why do you hate me ?']
>>> inti.predict(text,type='list')
[-0.2737383, 0.3481976]
# Predict intimacy for a long list of questions
>>> text = [a long list of questions]
>>> inti.predict(text,type='long_list',tqdm=tqdm)
[-0.2737383, 0.3481976, ... ,-0.2737383, 0.3481976]
Contact
Jiaxin Pei (pedropei@umich.edu)
Metadata
Release files for question-intimacy 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| question_intimacy-1.1.tar.gz | 2.9 kB | Details |
Release files / question_intimacy-1.1.tar.gz
| Download URL | question_intimacy-1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
962a0b1975f5e2de0ea6e14994e156c80ea5d86a90cd25ac409797e3195dcb66
|
|
BLAKE2b-256 checksum How to use checksums |
f288aa14c809c994180910063f6aef1d0492ddf03ea17a77bdf48c104b2eba4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5
|