<jupyter_start><jupyter_text>PassivePy Package Test<jupyter_code># first run this cell to install the package


!pip install -r https://raw.githubusercontent.com/mitramir55/PassivePy/main/PassivePyCode/PassivePySrc/requirements_lg.txt
!pip install -i https://test.pypi.org/simple/ PassivePy==0.0.58
# then run this to import the package and create PassivePy
import pandas as pd
import os
pd.set_option('display.max_colwidth', None)
from PassivePySrc import PassivePy


spacy_model = "en_core_web_lg"
passivepy = PassivePy.PassivePyAnalyzer(spacy_model)<jupyter_output><empty_output><jupyter_text>Single sentence example<jupyter_code># Try changing the sentence below:
sample_text = 'She has been killed'
passivepy.match_text(sample_text)
# analyze the components
passivepy.parse_sentence(sample_text)<jupyter_output>word: [32mShe[0m 
pos: PRON 
dependency: nsubjpass 
tag:  PRP 
lemma:  she
word: [32mhas[0m 
pos: AUX 
dependency: aux 
tag:  VBZ 
lemma:  have
word: [32mbeen[0m 
pos: AUX 
dependency: auxpass 
tag:  VBN 
lemma:  be
word: [32mkilled[0m 
pos: VERB 
dependency: ROOT 
tag:  VBN 
lemma:  kill
has been killed
[34mpassive_rule_1[0m<jupyter_text>Sentence-level from a dataset<jupyter_code># substitute the file_path in the following line with the address 
# of the CSV dataset you want to import the dataset
# example: df = pd.read_csv("D:\Data\paper_abstract_50_samples.csv")

df = pd.read_csv(file_path)
# write the name of the column that includes text in the 'column_name' variable:
# for example, here the column name is abstract_text

df_detected_s = passivepy.match_sentence_level(df=df, column_name = 'abstract_text')
df_detected_s<jupyter_output>Detecting Sentences...<jupyter_text>Corpus level<jupyter_code># Do the same for corpus level:

df_detected_c = passivepy.match_corpus_level(df=df, column_name = 'abstract_text')
df_detected_c.tail()
# export the result of the analysis on your system
# example: df_detected_s.to_csv("D:\Data\sentence_level_test_results.csv")

df_detected_s.to_csv(export_in_this_path)
df_detected_c.to_csv(export_in_this_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.091725768321513, 'fraction_numerical': 0.011347517730496455, 'mean_word_length': 6.557142857142857, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '452764', 'license': 'MIT', 'n_tokens_mistral': 812, 'n_tokens_neox': 771, 'n_words': 186, 'path': 'PassivePy.ipynb', 'repo_name': 'mitramir55/PassivePy', 'size': '2115'}