Skip to main content

This package is used to predict intimacy for questions

Project description

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)

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

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

Source Distribution

question_intimacy-1.1.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file question_intimacy-1.1.tar.gz.

File metadata

  • Download URL: question_intimacy-1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for question_intimacy-1.1.tar.gz
Algorithm Hash digest
SHA256 962a0b1975f5e2de0ea6e14994e156c80ea5d86a90cd25ac409797e3195dcb66
MD5 4e2c59eb31907ab872b1d6ca05f0535d
BLAKE2b-256 f288aa14c809c994180910063f6aef1d0492ddf03ea17a77bdf48c104b2eba4d

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