Skip to content

Commit

Permalink
Update project by code to expand dictionaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
chlor committed Oct 13, 2022
1 parent 73fa8ee commit 7818054
Show file tree
Hide file tree
Showing 14 changed files with 1,805,919 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Code and Resources for the POLAR project
# JULIE Lab's Code and Resources for the Use Case POLAR_MI

This repository contains code and resources for the [POLAR](https://www.medizininformatik-initiative.de/de/POLAR) project that may be made public.
The main content is the text analysis web application in the `pipeline-webservice` directory.
This repository contains code and resources for the
[Use Case POLAR_MI](https://www.medizininformatik-initiative.de/de/POLAR) that may be made public from the [JULIE Lab](https://julielab.de).

## Content
* The main content is the text analysis web application in the [pipeline-webservice](pipeline-webservice) directory.
* The content to produce dictionaries used in the _pipeline-webservice_ in the [create-dictionaries](create-dictionaries) directory.

For further details look in the _README.md_ files of the subfolders.
7 changes: 7 additions & 0 deletions create-dictionaries/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.json
*.idea
*.png
*.csv
out/
venv
pyvenv.cfg
21 changes: 21 additions & 0 deletions create-dictionaries/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 JULIE Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
295 changes: 295 additions & 0 deletions create-dictionaries/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
# Create German dictionaries by different German semantic resources

The code of this repository is able to create dictionaries of *synonyms*, *hyponyms* and *hypernyms* of a given
word list (text file [input/word_list.txt](input/word_list.txt)):

```text
Fall
fallen
gefallen
Unfall
Absturz
Sturz
Bruch
brechen
gebrochen
Oberschenkel
```

* Input for word lists used in Polar project:
* [input/delir.txt](input/delir.txt)
* [input/sturz.txt](input/sturz.txt)

## Resources

### Open WordNet
* install Open WordNet resources and run script from [install_language.py](install_language.py)

### GermaNet
* request [GermaNet](https://uni-tuebingen.de/fakultaeten/philosophische-fakultaet/fachbereiche/neuphilologie/seminar-fuer-sprachwissenschaft/arbeitsbereiche/allg-sprachwissenschaft-computerlinguistik/ressourcen/lexica/germanet-1/) files
* configure in [params.conf](param.conf) your GermaNet path
* Script configured and tested with GermaNet version 17.0 (_GN_V170_XML_)
* By usage of GermaNet, do not forget to [cite](https://uni-tuebingen.de/fakultaeten/philosophische-fakultaet/fachbereiche/neuphilologie/seminar-fuer-sprachwissenschaft/arbeitsbereiche/allg-sprachwissenschaft-computerlinguistik/ressourcen/lexica/germanet-1/germanet-zitieren/) it.

### Wiktionary
* Wiktionary items are processed by wiktionary dumps,
e.g.: [current dump](https://dumps.wikimedia.org/dewiktionary/latest/dewiktionary-latest-pages-meta-current.xml.bz2)
* The wiktionary dump file is processed by an own script in Jan / Feb 2022 by an own separated script.
* The preprocessed data (json files) from Jan / Feb 2022 is stored in [wiktionray/wiktionary_de_semantic_relations.json](wiktionray/wiktionary_de_semantic_relations.json)
* Configure `wiktionary_de_semantic_relations.json` in [params.conf](param.conf)

# Usage
## Configuration
* Prepare [input/word_list.txt](input/word_list.txt) with input parameters
* Configure [param.conf](param.conf) before usage with input words: one word == one line
* _request_soruces_: available modes are _wordnet, wiktionary, germanet_ and _combined_ to use the named resource together
* If you use GermaNet, configure the path of GermaNet files there

```editorconfig
[input]
path_input_words = input/word_list.txt
request_soruces = wordnet, wiktionary, germanet, combined
path_wiktionary_de = wiktionary/wiktionary_de_semantic_relations.json
path_germanet = /home/chlor/PycharmProjects/feattext/ext_res/germanet/GN_V170/GN_V170_XML
[output]
path_out = out
```
* run `python request_words.py param.conf `


## Output
* `all_values.tsv` with all counted values
* for every resource, a json file and a txt is produced, e.g. output snippets by Wiktionary resource:

```text
term category
Abstieg Fall-synonym-wkt
Casus Fall-synonym-wkt
Kasus Fall-synonym-wkt
Niedergang Fall-synonym-wkt
Patient Fall-synonym-wkt
Bewegung Fall-hypernym-wkt
Laufendes Gut Fall-hypernym-wkt
...
rational gebrochen-hypernym-wkt
Bein Oberschenkel-hypernym-wkt
Körperteil Oberschenkel-hypernym-wkt
Schenkel Oberschenkel-hypernym-wkt
```


```text
{
"Absturz": {
"hyponyms": [
"Bergsteigerabsturz",
"Bungee-Jumper-Absturz",
"Flugzeugabsturz",
"Gondelabsturz",
"Helikopterabsturz",
"Hubschrauberabsturz",
"Klettererabsturz",
"Meteorabsturz",
"Meteoritenabsturz",
"Programmabsturz",
"Raumfährenabsturz",
"Satellitenabsturz",
"UFO-Absturz",
"Zinsen-Absturz"
],
"hyponyms_len": 14,
"synonyms": [
"Computerabsturz"
],
"synonyms_len": 1
},
"Bruch": {
"hypernyms": [
"Ablösung",
"Diebstahl",
"Fraktur",
"Raub",
"Rechenoperation",
"Störung",
"Symbol",
"Trennung",
"Verbrechen",
"Verstoß",
"Weinfehler",
"Zweig",
"Überrest"
],
"hypernyms_len": 13,
"hyponyms": [
"Abbruch",
"Achsenbruch",
"Anbruch",
"Armbruch",
"Aufbruch",
"Ausbruch",
"Beckenbruch",
"Beinbruch",
"Brauner Bruch",
"Dammbruch",
"Deichbruch",
"Dezimalbruch",
"Durchbruch",
"Ehebruch",
"Emscherbruch",
"Erlenbruch",
"Ermüdungsbruch",
"Friedensbruch",
"Gesetzesbruch",
"Glasbruch",
"Grabenbruch",
"Grauer Bruch",
"Handknochenbruch",
"Hausfriedensbruch",
"Kettenbruch",
"Kieferbruch",
"Kleidung",
"Koalitionsbruch",
"Lebensbruch",
"Leistenbruch",
"Mastbruch",
"Nabelbruch",
"Oberschenkelhalsbruch",
"Oderbruch",
"Radbruch",
"Rechtsbruch",
"Rohrbruch",
"Schiffbruch",
"Schotbruch",
"Schwarzer Bruch",
"Schädelbruch",
"Steinbruch",
"Stilbruch",
"Stimmbruch",
"Tabubruch",
"Tarifbruch",
"Traditionsbruch",
"Treuebruch",
"Umbruch",
"Verfassungsbruch",
"Vertragsbruch",
"Vertrauensbruch",
"Weißer Bruch",
"Windbruch",
"Wolkenbruch",
"Wortbruch",
"Zehenbruch",
"Zehnerbruch",
"Zivilisationsbruch",
"Zusammenbruch",
"Zwerchfellbruch"
],
"hyponyms_len": 61,
"synonyms": [
"Abfall",
"Abkehr",
"Abspaltung",
"Abteilung",
"Abtrennung",
"Ausschuss",
"Bauschutt",
"Beinkleid",
"Bresche",
"Bruchteil",
"Bruchzahl",
"Canyon",
"Dissens",
"Distanz",
"Ehescheidung",
"Einbruch",
"Einschnitt",
"Entzweiung",
"Fahrlässigkeit",
"Falte",
"Falz",
"Fehler",
"Fehltritt",
"Fehlverhalten",
"Feindschaft",
"Feindseligkeit",
"Fraktur",
"Fuge",
"Furche",
"Gezänk",
"Hader",
"Hass",
"Hernie",
"Hose",
"Händel",
"Kehricht",
"Klamm",
"Knacks",
"Knick",
"Kniff",
"Knitter",
"Knochenbruch",
"Krach",
"Leck",
"Lockerung",
"Lossagung",
"Luch",
"Lösung",
"Lücke",
"Marsch",
"Marschland",
"Meinungsverschiedenheit",
"Moor",
"Morast",
"Mulde",
"Narbe",
"Nichtbeachtung",
"Nichtbefolgung",
"Nichterfüllung",
"Panne",
"Pass",
"Pflichtvergessenheit",
"Plunder",
"Quotient",
"Ramsch",
"Renitenz",
"Restmüll",
"Riss",
"Ritze",
"Sabotage",
"Sachbeschädigung",
"Sachschaden",
"Saumseligkeit",
"Scheidung",
"Schisma",
"Schleuderware",
"Spalt",
"Spalte",
"Spaltung",
"Sprung",
"Streit",
"Sumpf",
"Trennung",
"Umschlag",
"Umwälzung",
"Ungehorsam",
"Unterbrechung",
"Unterlassung",
"Untreue",
"Verfehlung",
"Verfeindung",
"Verletzung",
"Versäumnis",
"Verwerfung",
"Widerspenstigkeit",
"Zerbrochenes",
"Zerwürfnis",
"Zuwiderhandlung",
"Zwischenraum",
"Zäsur",
"rationale Zahl",
"Übertretung"
],
"synonyms_len": 102
}
}
```
6 changes: 6 additions & 0 deletions create-dictionaries/config_lang.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"wordnet_languages":
{
"de": "odenet:1.4"
}
}
22 changes: 22 additions & 0 deletions create-dictionaries/input/delir.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
delirium
verwirrt
Verwirrung
Änderung im mentalen Zustand
Änderung des mentalen Zustands
Veränderung im mentalen Zustand
Veränderung des mentalen Zustands
veränderter mentaler Zustand
desorientiert
abgestumpft
lethargisch
Demenz
Alzheimer
unkommunikativ
Gedächtnisverlust
unkooperativ
dement
enzephalopathisch
Enzephalopathie
stümperhaft
angriffslustig
streitlustig
10 changes: 10 additions & 0 deletions create-dictionaries/input/sturz.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Fall
fallen
gefallen
Unfall
Absturz
Sturz
Bruch
brechen
gebrochen
Oberschenkel
10 changes: 10 additions & 0 deletions create-dictionaries/input/word_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Fall
fallen
gefallen
Unfall
Absturz
Sturz
Bruch
brechen
gebrochen
Oberschenkel
Loading

0 comments on commit 7818054

Please sign in to comment.