Commit 90d6916f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update RecordPubli to use new pattern defining affiliation.

parent 15d50703
......@@ -312,21 +312,21 @@ class RecordPubli(Record):
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`.
- 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)
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:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment