Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
e4ebb943
Commit
e4ebb943
authored
Jan 05, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://delanoe.org:1979/gargantext
into samuel
parents
ea2c34dd
80dd36a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
functions.py
analysis/functions.py
+3
-3
EuropressFileParser.py
parsing/FileParsers/EuropressFileParser.py
+3
-3
No files found.
analysis/functions.py
View file @
e4ebb943
...
@@ -243,9 +243,9 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', n=150
...
@@ -243,9 +243,9 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', n=150
def
tfidf
(
corpus
,
document
,
ngram
):
def
tfidf
(
corpus
,
document
,
ngram
):
try
:
try
:
x
=
Node_Ngram
.
objects
.
get
(
node
=
document
,
ngram
=
ngram
)
.
weight
occurences_of_ngram
=
Node_Ngram
.
objects
.
get
(
node
=
document
,
ngram
=
ngram
)
.
weight
y
=
Node_Ngram
.
objects
.
filter
(
node
=
document
)
.
count
(
)
ngrams_by_document
=
sum
([
x
.
weight
for
x
in
Node_Ngram
.
objects
.
filter
(
node
=
document
)]
)
t
f
=
x
/
y
t
erm_frequency
=
occurences_of_ngram
/
ngrams_by_document
xx
=
Node
.
objects
.
filter
(
parent
=
corpus
,
type
=
NodeType
.
objects
.
get
(
name
=
"Document"
))
.
count
()
xx
=
Node
.
objects
.
filter
(
parent
=
corpus
,
type
=
NodeType
.
objects
.
get
(
name
=
"Document"
))
.
count
()
yy
=
Node_Ngram
.
objects
.
filter
(
ngram
=
ngram
)
.
count
()
yy
=
Node_Ngram
.
objects
.
filter
(
ngram
=
ngram
)
.
count
()
...
...
parsing/FileParsers/EuropressFileParser.py
View file @
e4ebb943
...
@@ -138,9 +138,9 @@ class EuropressFileParser(FileParser):
...
@@ -138,9 +138,9 @@ class EuropressFileParser(FileParser):
# metadata['language_iso2'] = 'en'
# metadata['language_iso2'] = 'en'
# metadata['publication_year'] = metadata['
date'].strftime('%Y')
metadata
[
'publication_year'
]
=
metadata
[
'publication_
date'
]
.
strftime
(
'
%
Y'
)
# metadata['publication_month'] = metadata['
date'].strftime('%m')
metadata
[
'publication_month'
]
=
metadata
[
'publication_
date'
]
.
strftime
(
'
%
m'
)
# metadata['publication_day'] = metadata['
date'].strftime('%d')
metadata
[
'publication_day'
]
=
metadata
[
'publication_
date'
]
.
strftime
(
'
%
d'
)
metadata
[
'publication_date'
]
=
""
metadata
[
'publication_date'
]
=
""
metadata
[
'object_id'
]
=
str
(
metadata
[
'text'
][
-
9
])
metadata
[
'object_id'
]
=
str
(
metadata
[
'text'
][
-
9
])
...
...
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