Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
90d6916f
Commit
90d6916f
authored
Oct 28, 2019
by
LE GAC Renaud
Browse files
Update RecordPubli to use new pattern defining affiliation.
parent
15d50703
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
modules/invenio_tools/recordpubli.py
modules/invenio_tools/recordpubli.py
+8
-9
No files found.
modules/invenio_tools/recordpubli.py
View file @
90d6916f
...
...
@@ -312,21 +312,21 @@ class RecordPubli(Record):
Args:
pattern (unicode):
regular expression defining the affiliation keys.
It should not contains groups.
It has to be build for an exact match namely containing
start and end of string. This is reuqired to separate
`Ecole Plolytechnique` from `Ecole Polytechnique, Lausanne`.
Returns:
unicode:
- the affiliation
- the affiliation
or the first one when several are found.
- empty string when nothing is found.
"""
# modify the pattern to capture group
pattern
=
"(%s)"
%
pattern
data
=
(
self
[
u
"700"
].
u
.
str
.
extract
(
pattern
,
expand
=
False
)
.
dropna
())
df
=
self
[
u
"700"
]
query
=
df
.
u
.
str
.
contains
(
pattern
)
data
=
(
df
[
query
].
u
.
unique
())
return
(
data
.
iloc
[
0
]
if
len
(
data
)
>
0
else
u
""
)
return
(
data
[
0
]
if
len
(
data
)
>
0
else
u
""
)
def
find_authors
(
self
,
pattern
,
sep
=
u
", "
,
sort
=
False
):
"""Find authors containing the regular expression *pattern*.
...
...
@@ -385,7 +385,6 @@ class RecordPubli(Record):
"""
df
=
self
[
u
"700"
]
query
=
df
.
u
.
str
.
contains
(
pattern
)
if
sort
:
...
...
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