Skip to main content

No project description provided

Project description

reading-impact-model

Reading Impact Model for analyzing reading impact in online book reviews.

Usage

Basic usage of the English language impact model:

from reading_impact_model.matcher import Matcher
from reading_impact_model import model_loader

impact_model_en = model_loader(lang='en')
matcher_en = Matcher(impact_model_en, debug=False)

sent_en = 'The writing is beautiful.'

matches = matcher_en.match_rules(sentence=sent_en)

for match in matches:
    print(match.match_word)                  # 'beautiful'
    print(match.impact_term)                 # 'beautiful'
    print(match.impact_term_type)            # 'style'
    for condition_match in match.condition_matches:
        print(condition_match.match_word)     # 'writing'
        print(condition_match.condition_term) # 'writing'
        print(condition_match.condition_type) # 'style'

The matcher accepts sentences as string but also Spacy sent objects:

import spacy
from reading_impact_model.matcher import Matcher
from reading_impact_model import model_loader

impact_model = model_loader(lang='en')
matcher = Matcher(impact_model, debug=False)

nlp = spacy.load('en_core_news_lg')

sentence = 'The dialogue is full of witty banter.'

doc = nlp(sentence)
for sent in doc.sents:
    print(sent)
    matches = matcher.match_rules(sentence=sent)
    for match in matches:
        print(match.json)

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

reading_impact_model-0.2.0.tar.gz (652.2 kB view hashes)

Uploaded Source

Built Distribution

reading_impact_model-0.2.0-py3-none-any.whl (575.9 kB view hashes)

Uploaded Python 3

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