mirror of
https://github.com/alanorth/cgspace-notes.git
synced 2024-11-24 07:30:18 +01:00
content/posts/2022-08.md: syntax fix
This commit is contained in:
parent
47f2c6c17f
commit
ba6f826201
@ -165,7 +165,7 @@ $ xsv join --left id ~/Downloads/2022-08-18-MELIAs-UTF-8-With-Files.csv id ~/Dow
|
|||||||
- I was previously splitting up the text value field (title/abstract/etc) by spaces and searching for each word in the list of terms/countries like this:
|
- I was previously splitting up the text value field (title/abstract/etc) by spaces and searching for each word in the list of terms/countries like this:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
with open(r"/tmp/cgspace-countries.txt",'r') as f :
|
with open(r"/tmp/cgspace-countries.txt",'r') as f:
|
||||||
countries = [name.rstrip().lower() for name in f]
|
countries = [name.rstrip().lower() for name in f]
|
||||||
|
|
||||||
return "||".join([x for x in value.split(' ') if x.lower() in countries])
|
return "||".join([x for x in value.split(' ') if x.lower() in countries])
|
||||||
@ -176,7 +176,7 @@ return "||".join([x for x in value.split(' ') if x.lower() in countries])
|
|||||||
```console
|
```console
|
||||||
import re
|
import re
|
||||||
|
|
||||||
with open(r"/tmp/agrovoc-subjects.txt",'r') as f :
|
with open(r"/tmp/agrovoc-subjects.txt",'r') as f:
|
||||||
terms = [name.rstrip().lower() for name in f]
|
terms = [name.rstrip().lower() for name in f]
|
||||||
|
|
||||||
return "||".join([term for term in terms if re.match(r".*\b" + term + r"\b.*", value.lower())])
|
return "||".join([term for term in terms if re.match(r".*\b" + term + r"\b.*", value.lower())])
|
||||||
|
Loading…
Reference in New Issue
Block a user