Skip to content

Commit

Permalink
Merge pull request #75 from rbroc/fix-pos
Browse files Browse the repository at this point in the history
Fix pos_stats extraction
  • Loading branch information
HLasse authored Dec 5, 2022
2 parents 78a2eb0 + 4479223 commit b189234
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion textdescriptives/about.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__title__ = "textdescriptives"
__version__ = "1.1.0" # the ONLY source of version ID
__version__ = "1.1.1" # the ONLY source of version ID
__download_url__ = "https://github.com/HLasse/textdescriptives"
9 changes: 4 additions & 5 deletions textdescriptives/dataframe_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ def __init__(

if "all" in metrics:
for component in valid_metrics - set(["all"]):
if doc.has_extension(component) or component == "descriptive_stats":
extraction.append(self.__unpack_extension(doc, component))

extraction.append(self.__unpack_extension(doc, component))
else:
for component in metrics:
if doc.has_extension(component) or component == "descriptive_stats":
extraction.append(self.__unpack_extension(doc, component))
extraction.append(self.__unpack_extension(doc, component))

if self.as_dict:
self.out = reduce(lambda a, b: {**a, **b}, extraction)
Expand Down Expand Up @@ -96,6 +93,8 @@ def __unpack_extension(self, doc: Doc, extension: str) -> pd.DataFrame:
# we only need the getter
if extension == "descriptive_stats":
values = self.__get_descriptive_stats_dict(doc)
elif extension == "pos_stats":
values = doc.get_extension('pos_proportions')[2](doc)
else:
values = doc.get_extension(extension)[2](doc)

Expand Down

1 comment on commit b189234

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
textdescriptives
   __init__.py40100% 
   dataframe_extract.py69593%128–132
   load_components.py120100% 
textdescriptives/components
   __init__.py50100% 
   dependency_distance.py320100% 
   descriptive_stats.py51198%108
   pos_stats.py25292%14, 46
   quality.py1931194%101, 107, 125, 130, 169, 175, 196, 202, 445, 448, 455
   readability.py720100% 
   utils.py24388%59–62
TOTAL4872295% 

Please sign in to comment.