Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jaime Collado
/
textflow
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a9b79724
authored
Dec 14, 2022
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
relative frequency of POS tags added and notebook updated
parent
f0547ed3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
Examples/AnalyzeADataframe.ipynb
pyproject.toml
textflow/POSAnalyzer.py
Examples/AnalyzeADataframe.ipynb
View file @
a9b79724
This diff could not be displayed because it is too large.
pyproject.toml
View file @
a9b79724
...
...
@@ -11,6 +11,7 @@ spacy = "^3.3.0"
transformers
=
"^4.19.0"
torch
=
{version
=
"^1.11.0"
,
python
=
"^3.7"
,
platform
=
"linux"
}
lexical-diversity
=
"^0.1.1"
emoji
=
"^1.7.0"
[tool.poetry.dev-dependencies]
pytest
=
"^5.2"
...
...
textflow/POSAnalyzer.py
View file @
a9b79724
...
...
@@ -47,7 +47,8 @@ class POSAnalyzer(Analyzer):
arrayResults
=
[]
for
text
in
arrayText
:
srcPOS
=
[]
dicFreqPOS
=
{}
dicFreqPOS
=
{}
dicRelFreqPOS
=
{}
doc
=
self
.
nlp
(
text
)
for
token
in
doc
:
srcPOS
.
append
(
token
.
pos_
)
...
...
@@ -55,9 +56,12 @@ class POSAnalyzer(Analyzer):
dicFreqPOS
[
token
.
pos_
]
+=
1
else
:
dicFreqPOS
[
token
.
pos_
]
=
1
for
tag
in
dicFreqPOS
:
dicRelFreqPOS
[
tag
]
=
dicFreqPOS
[
tag
]
/
len
(
doc
)
pos
=
{
"srcPOS"
:
srcPOS
,
"FreqPOS"
:
dicFreqPOS
"FreqPOS"
:
dicFreqPOS
,
"RelFreqPOS"
:
dicRelFreqPOS
}
arrayResults
.
append
(
pos
)
return
arrayResults
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment