Metadata-Version: 2.1
Name: reading-impact-model
Version: 0.2.0
Summary: 
Home-page: https://github.com/marijnkoolen/reading-impact-model
License: MIT
Author: Marijn Koolen
Author-email: marijn.koolen@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Dist: pytest (>=7.2.2,<8.0.0)
Requires-Dist: xmltodict (>=0.13.0,<0.14.0)
Project-URL: Repository, https://github.com/marijnkoolen/reading-impact-model
Description-Content-Type: text/markdown

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

## Usage

Basic usage of the English language impact model:
```python
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:

```python
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)
```

