freemt commited on
Commit
bccd6e8
1 Parent(s): de62ea4

Ready 0.1.0a0

Browse files
.stignore ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build
13
+ develop-eggs
14
+ dist
15
+ downloads
16
+ eggs
17
+ .eggs
18
+ lib
19
+ lib64
20
+ parts
21
+ sdist
22
+ var
23
+ wheels
24
+ pip-wheel-metadata
25
+ share/python-wheels
26
+ *.egg-info
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Translations
42
+ *.mo
43
+ *.pot
44
+
45
+ # Django stuff:
46
+ *.log
47
+ local_settings.py
48
+ db.sqlite3
49
+
50
+ # Flask stuff:
51
+ instance
52
+ .webassets-cache
53
+
54
+ # Scrapy stuff:
55
+ .scrapy
56
+
57
+ # Sphinx documentation
58
+ docs/_build
59
+
60
+ # PyBuilder
61
+ target
62
+
63
+ # Jupyter Notebook
64
+ .ipynb_checkpoints
65
+
66
+ # IPython
67
+ profile_default
68
+ ipython_config.py
69
+
70
+ # pyenv
71
+ .python-version
72
+
73
+ # celery beat schedule file
74
+ celerybeat-schedule
75
+
76
+ # SageMath parsed files
77
+ *.sage.py
78
+
79
+ # Environments
80
+ .env
81
+ .venv
82
+ env
83
+ venv
84
+ ENV
85
+ env.bak
86
+ venv.bak
87
+
88
+ # Spyder project settings
89
+ .spyderproject
90
+ .spyproject
91
+
92
+ # Rope project settings
93
+ .ropeproject
94
+
95
+ # mypy
96
+ .mypy_cache
97
+ .dmypy.json
98
+ dmypy.json
99
+
100
+ # Pyre type checker
101
+ .pyre
app.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Create entry."""
2
+ # pylint: disbale=invalid-name
3
+ import gradio as gr
4
+ import pandas as pd
5
+
6
+ from about_time import about_time
7
+ from aset2pairs import aset2pairs
8
+ from cmat2aset import cmat2aset
9
+ from logzero import logger
10
+ from typing import List, Optional, Union
11
+ from hf_model_s_cpu import model_s
12
+
13
+ from radio_mlbee import __version__
14
+ from radio_mlbee.gen_cmat import gen_cmat
15
+ from radio_mlbee.utils import text1, text2
16
+
17
+
18
+ def greet(name):
19
+ """Greet."""
20
+ if not name:
21
+ name = "world"
22
+ return "Hello " + name + "!! (coming sooooon...)"
23
+
24
+
25
+ def ml_fn(
26
+ text1: str,
27
+ text2: str,
28
+ # split_to_sents: bool = False
29
+ ) -> pd.DataFrame:
30
+ """Align text1 text2"""
31
+ text1 = str(text1)
32
+ text2 = str(text2)
33
+ try:
34
+ paras1 = text1.splitlines()
35
+ paras1 = [_.strip() for _ in paras1 if _.strip()]
36
+ except Exception as exc:
37
+ logger.error(" praras.slpitlines() erros: %s, setting to ['']", exc)
38
+ paras1 = [""]
39
+ try:
40
+ paras2 = text2.splitlines()
41
+ paras2 = [_.strip() for _ in paras2 if _.strip()]
42
+ except Exception as exc:
43
+ logger.error(" praras slpitlines erros: %s, setting to ['']", exc)
44
+ paras2 = [""]
45
+
46
+ # if split_to_sents: ... # TODO
47
+
48
+ with about_time() as t:
49
+ cmat = gen_cmat(paras1, paras2)
50
+ aset = cmat2aset(cmat)
51
+
52
+ _ = len(paras1) + len(paras2)
53
+ av = t.duration / _ * 1000
54
+ logger.info(" %s blocks, took %s, av. %s s/1000 blk", _, t.duration_human, av)
55
+
56
+ pairs = aset2pairs(paras1, paras2, aset)
57
+ df = pd.DataFrame(pairs, columns=["text1", "text2", "llh"])
58
+
59
+ # return pd.DataFrame([["", "", ""]])
60
+ return df
61
+
62
+
63
+ mlbee = gr.Interface(
64
+ fn=ml_fn,
65
+ inputs=[
66
+ "textarea",
67
+ "textarea",
68
+ # gr.Checkbox(label="Split to sents?"),
69
+ ],
70
+ outputs="dataframe",
71
+ title=f"radio-mlbee {__version__}",
72
+ description="mlbee rest api ",
73
+ examples=[
74
+ # ["a b", "cd", False],
75
+ # [text1, text2, False],
76
+ [text1, text2],
77
+ ]
78
+ )
79
+
80
+
81
+ mlbee.launch(
82
+ show_error=True,
83
+ enable_queue=True,
84
+ )
gradio_queue.db ADDED
Binary file (28.7 kB). View file
 
install-sw.sh ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pip install pipx
2
+ # pipx install poetry
3
+ # pipx ensurepath
4
+ # source ~/.bashrc
5
+
6
+ # curl -sSL https://install.python-poetry.org | python3 -
7
+ # -C- continue -S show error -o output
8
+ curl -sSL -C- -o install-poetry.py https://install.python-poetry.org
9
+ python install-poetry.py
10
+ rm install-poetry.py
11
+ echo export PATH=~/.local/bin:$PATH > ~/.bashrc
12
+ source ~/.bashrc
13
+ # ~/.local/bin/poetry install
14
+
15
+ wget -c https://deb.nodesource.com/setup_12.x
16
+ bash setup_12.x
17
+ apt-get install -y nodejs
18
+ npm install -g npm@latest
19
+ npm install -g nodemon
20
+ rm setup_12.x
21
+
22
+ # apt upate # alerady done in apt-get install -y nodejs
23
+ apt install byobu -y > /dev/null 2>&1
24
+
okteto.yml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: gradio-cmat
2
+
3
+ # The build section defines how to build the images of
4
+ # your development environment
5
+ # More info: https://www.okteto.com/docs/reference/manifest/#build
6
+ # build:
7
+ # my-service:
8
+ # context: .
9
+
10
+ # The deploy section defines how to deploy your development environment
11
+ # More info: https://www.okteto.com/docs/reference/manifest/#deploy
12
+ # deploy:
13
+ # commands:
14
+ # - name: Deploy
15
+ # command: echo 'Replace this line with the proper 'helm'
16
+
17
+ # or 'kubectl' commands to deploy your development environment'
18
+
19
+ # The dependencies section defines other git repositories to be
20
+ # deployed as part of your development environment
21
+ # More info: https://www.okteto.com/docs/reference/manifest/#dependencies
22
+ # dependencies:
23
+ # - https://github.com/okteto/sample
24
+ # The dev section defines how to activate a development container
25
+ # More info: https://www.okteto.com/docs/reference/manifest/#dev
26
+ dev:
27
+ gradio-cmat:
28
+ # image: okteto/dev:latest
29
+ # image: python:3.8.13-bullseye
30
+ # image: simbachain/poetry-3.8
31
+ image: python:3.8
32
+ command: bash
33
+ workdir: /usr/src/app
34
+ sync:
35
+ - .:/usr/src/app
36
+ environment:
37
+ - name=$USER
38
+ forward:
39
+ - 7861:7861
40
+ - 7860:7860
41
+ - 8501:8501
42
+ reverse:
43
+ - 9000:9000
44
+ autocreate: true
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml CHANGED
@@ -13,6 +13,18 @@ logzero = "^1.7.0"
13
  set-loglevel = "^0.1.2"
14
  icecream = "^2.1.1"
15
  install = "^1.3.5"
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  [tool.poe.executor]
18
  type = "poetry"
 
13
  set-loglevel = "^0.1.2"
14
  icecream = "^2.1.1"
15
  install = "^1.3.5"
16
+ torch = [
17
+ {url = "https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp38-cp38-linux_x86_64.whl", markers = "sys_platform == 'linux'"},
18
+ {url = "https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp38-cp38-win_amd64.whl", markers = "sys_platform == 'win32'"}
19
+ ]
20
+ sentence-transformers = "^2.2.0"
21
+ hf-model-s-cpu = "^0.1.1"
22
+ gradio = "^3.0.15"
23
+ aset2pairs = "^0.1.0"
24
+ cmat2aset = "^0.1.0-alpha.7"
25
+ more-itertools = "^8.13.0"
26
+ cchardet = "^2.1.7"
27
+ typer = "^0.4.1"
28
 
29
  [tool.poe.executor]
30
  type = "poetry"
radio-mlbee DELETED
@@ -1 +0,0 @@
1
- Subproject commit c2531daf8a7ced27c691e83be6a08869dffdad83
 
 
radio_mlbee/app.py DELETED
@@ -1,12 +0,0 @@
1
- """Create entry."""
2
- import gradio as gr
3
-
4
- def greet(name):
5
- """Greet."""
6
- if not name:
7
- name = "world"
8
- return "Hello " + name + "!! (coming sooooon...)"
9
-
10
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
11
-
12
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
radio_mlbee/cos_matrix2.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Compute the cosine similarity matrix of A.
2
+
3
+ https://stackoverflow.com/questions/17627219/whats-the-fastest-way-in-python-to-calculate-cosine-similarity-given-sparse-mat
4
+ """
5
+ from typing import Optional
6
+
7
+ import numpy as np
8
+
9
+
10
+ def cos_matrix2(mat1: np.ndarray, mat2: Optional[np.ndarray] = None) -> np.ndarray:
11
+ """Compute the cosine similarity matrix of mat1, mat2: mat1 * mat2.T.
12
+
13
+ Args:
14
+ mat1: np.asarray
15
+ mat2: [Optional], if not present mat2 = mat1
16
+ Returns
17
+ cosine similarity
18
+ """
19
+ if not isinstance(mat1, np.ndarray):
20
+ mat1 = np.asarray(mat1, dtype=np.float32)
21
+
22
+ if mat2 is None:
23
+ mat2 = mat1.copy()
24
+
25
+ if not isinstance(mat2, np.ndarray):
26
+ mat2 = np.asarray(mat2, dtype=np.float32)
27
+
28
+ if mat1.shape[1] != mat2.shape[1]:
29
+ print("shape mismatch: %s, %s", mat1.shape, mat2.shape)
30
+ raise SystemError(1)
31
+ cosine = np.dot(mat1, mat2.T)
32
+
33
+ norm1 = np.linalg.norm(mat1, axis=1)
34
+ norm2 = np.linalg.norm(mat2, axis=1)
35
+
36
+ # if not (norm1 and norm2): return 0
37
+
38
+ size1 = norm1.size
39
+ size2 = norm2.size
40
+ norm_mat = np.dot(norm1.reshape(size1, 1), norm2.reshape(1, size2))
41
+
42
+ for idx in range(size1):
43
+ for jdx in range(size2):
44
+ if norm_mat[idx, jdx] == 0:
45
+ cosine[idx, jdx] = 0.0
46
+ else:
47
+ cosine[idx, jdx] = cosine[idx, jdx] / norm_mat[idx, jdx]
48
+ return cosine
radio_mlbee/data/sternstunden04-de.txt ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Das Genie einer Nacht
2
+
3
+ Die Marseillaise, 25. April 1792
4
+
5
+ Das Genie einer Nacht
6
+
7
+ 1792. Zwei Monate, drei Monate schon schwankt in der französischen Nationalversammlung die Entscheidung: Krieg gegen die Koalition der Kaiser und Könige oder Frieden. Ludwig XVI. ist selbst unentschlossen; er ahnt die Gefahr eines Sieges der Revolutionäre, er ahnt die Gefahr ihrer Niederlage. Ungewiß sind auch die Parteien. Die Girondisten drängen zum Kriege, um die Macht zu behalten, Robespierre und die Jakobiner fechten für den Frieden, um inzwischen selbst die Macht an sich zu reißen. Von Tag zu Tag wird die Lage gespannter, die Journale lärmen, die Klubs diskutieren, immer wilder schwirren die Gerüchte, und immer mehr wird die öffentliche Meinung durch sie erregt. Wie immer eine Entscheidung, wird es darum eine Art von Befreiung, wie am 20. April der König von Frankreich endlich den Krieg an den Kaiser von Österreich und den König von Preußen erklärt.
8
+
9
+ Lastend und seelenverstörend hat in diesen Wochen und Wochen die elektrische Spannung über Paris gelegen; aber noch drückender, noch drohender schwült die Erregung in den Grenzstädten. In allen Biwaks sind schon die Truppen versammelt, in jedem Dorf, in jeder Stadt werden Freiwillige und Nationalgarden ausgerüstet, überall die Festungen instand gesetzt, und vor allem im Elsaß weiß man, daß auf seiner Scholle, wie immer zwischen Frankreich und Deutschland, die erste Entscheidung fallen wird. An den Ufern des Rheins ist der Feind, der Gegner, nicht wie in Paris ein verschwommener, ein pathetisch-rhetorischer Begriff, sondern sichtbare, sinnliche Gegenwart; denn an dem befestigten Brückenkopf, von dem Turm der Kathedrale, kann man die heranrückenden Regimenter der Preußen mit freiem Auge wahrnehmen. Nachts trägt der Wind das Rollen der feindlichen Artilleriewagen, das Klirren der Waffen, die Trompetensignale über den gleichgültig im Mondlicht glitzernden Strom. Und alle wissen: nur ein einziges Wort, nur ein einziges Dekret ist vonnöten, und aus dem schweigenden Mund der preußischen Kanonen fährt Donner und Blitz, und der tausendjährige Kampf zwischen Deutschland und Frankreich hat abermals begonnen – diesmal im Namen der neuen Freiheit auf der einen Seite und im Namen der alten Ordnung auf der andern.
10
+
11
+ Unvergleichlicher Tag darum, da am 25. April 1792 Stafetten die Nachricht der erfolgten Kriegserklärung aus Paris nach Straßburg bringen. Sofort strömt aus allen Gassen und Häusern das Volk auf die offenen Plätze, kriegsbereit marschiert die ganze Garnison zur letzten Parade, Regiment nach Regiment. Auf dem Hauptplatz erwartet sie der Bürgermeister Dietrich, die dreifarbige Schärpe um den Leib, die Kokarde auf dem Hut, den er grüßend den Soldaten entgegenschwenkt. Fanfarenruf und Trommelwirbel mahnt zur Stille. Mit lauter Stimme liest Dietrich an diesem und allen andern Plätzen der Stadt französisch und deutsch den Wortlaut der Kriegserklärung vor. Nach seinen letzten Worten intonieren die Regimentsmusiker das erste, das vorläufige Kriegslied der Revolution, das »Ça ira«, eigentlich eine prickelnde, übermütige, spöttische Tanzmelodie, aber die klirrenden, die donnernden Schritte der ausmarschierenden Regimenter geben ihr martialischen Takt. Dann zerstreut sich die Menge und trägt die angefachte Begeisterung in alle Gassen und Häuser; in den Cafés, in den Klubs werden zündende Ansprachen gehalten und Proklamationen verteilt. »Aux armes, citoyens! L'étendard de la guerre est déployé! Le signal est donné!«; so und mit ähnlichen Anrufen beginnen sie, und überall, in allen Reden, in allen Zeitungen, auf allen Plakaten, auf allen Lippen wiederholen sich solche schlagkräftige, rhythmische Rufe wie »Aux armes, citoyens! Qu'ils tremblent donc, les despotes couronnés! Marchons, enfants de la liberté!«, und jedesmal jubelt und jubelt die Masse den feurigen Worten zu.
12
+
13
+ Immer jubelt die große Masse auf den Straßen und Plätzen bei einer Kriegserklärung, immer aber regen sich in solchen Augenblicken des Straßenjubels auch andere Stimmen, leisere, abseitige; auch die Angst, auch die Sorge wacht auf bei einer Kriegserklärung, nur daß sie heimlich in den Stuben flüstert oder mit blasser Lippe schweigt. Ewig und überall sind Mütter, die sich sagen: Werden die fremden Soldaten nicht meine Kinder hinmorden, in allen Ländern sind die Bauern, die um ihre Habe sorgen, ihre Felder, ihre Hütten, ihr Vieh und ihre Ernte. Wird ihre Saat nicht zerstampft werden, ihr Haus nicht geplündert von den brutalen Horden, nicht mit Blut die Felder ihrer Arbeit gedüngt? Aber der Bürgermeister von Straßburg, Friedrich Baron Dietrich, eigentlich ein Aristokrat, aber wie die beste Aristokratie Frankreichs damals der Sache der neuen Freiheit mit ganzer Seele hingegeben, will nur die lauten, die klingenden Stimmen der Zuversicht zu Wort kommen lassen; bewußt verwandelt er den Tag der Kriegserklärung in ein öffentliches Fest. Die Schärpe quer um die Brust, eilt er von einer Versammlung zur andern, um die Bevölkerung anzufeuern. Er läßt Wein und Zehrung an die abmarschierenden Soldaten verteilen, und am Abend versammelt er in seinem geräumigen Hause auf der Place de Broglie die Generalität, die Offiziere und wichtigsten Amtspersonen zu einem Abschiedsfest, dem Begeisterung schon im vornherein den Charakter eines Siegesfestes gibt. Die Generäle, siegessicher wie immer Generäle, präsidieren, die jungen Offiziere, die im Krieg den Sinn ihres Lebens erfüllt sehen, haben freies Wort. Einer feuert den andern an. Man schwingt die Säbel, man umarmt sich, man trinkt sich zu, man hält bei gutem Wein leidenschaftliche und immer leidenschaftlichere Reden. Und abermals kehren dieselben stimulierenden Worte der Journale und Proklamationen in allen Ansprachen wieder: »Auf zu den Waffen, Bürger! Marschieren wir! Retten wir das Vaterland! Bald werden sie zittern, die gekrönten Despoten. Jetzt, da sich die Fahne des Sieges entrollt hat, ist der Tag gekommen, die Trikolore über die Welt zu tragen! Jeder muß jetzt sein Bestes geben, für den König, für die Fahne, für die Freiheit!« Das ganze Volk, das ganze Land will in solchen Augenblicken eine heilige Einheit werden durch den Glauben an den Sieg und durch Begeisterung für die Sache der Freiheit.
14
+
15
+ Plötzlich, mitten im Reden und Toastieren, wendet sich der Bürgermeister Dietrich einem jungen Hauptmann vom Festungskorps, namens Rouget, zu, der an seiner Seite sitzt. Er hat sich erinnert, daß dieser nette, nicht gerade hübsche, aber sympathische Offizier vor einem halben Jahr anläßlich der Proklamierung der Konstitution eine recht nette Hymne an die Freiheit geschrieben hat, die der Regimentsmusikus Pleyel gleich vertonte. Die anspruchslose Arbeit hatte sich sangbar erwiesen, die Militärkapelle hatte sie eingelernt, man hatte sie am öffentlichen Platz gespielt und im Chor gesungen. Wären jetzt die Kriegserklärung und der Abmarsch nicht gegebener Anlaß, eine ähnliche Feier zu inszenieren? So fragt Bürgermeister Dietrich ganz lässig, wie man eben einen guten Bekannten um eine Gefälligkeit bittet, den Kapitän Rouget (der sich völlig unberechtigterweise selbst geadelt hat und Rouget de Lisle nennt), ob er nicht den patriotischen Anlaß wahrnehmen wolle und für die ausmarschierenden Truppen etwas dichten, ein Kriegslied für die Rheinarmee, die morgen gegen den Feind ausrücken soll.
16
+
17
+ Rouget, ein bescheidener, unbedeutender Mann, der sich nie für einen großen Komponisten hielt – seine Verse wurden nie gedruckt, seine Opern refüsiert –, weiß, daß ihm Gelegenheitsverse leicht in die Feder fließen. Um der hohen Amtsperson und dem guten Freunde gefällig zu sein, erklärt er sich bereit. Ja, er wolle es versuchen. »Bravo, Rouget«, trinkt ein General von gegenüber ihm zu und mahnt ihn, er solle ihm dann gleich das Lied ins Feld nachschicken; irgendeinen schrittbeflügelnden, patriotischen Marschgesang könne die Rheinarmee wirklich brauchen. Inzwischen beginnt ein anderer eine Rede zu schwingen. Wieder wird toastiert, gelärmt, getrunken. Mit starker Woge geht die allgemeine Begeisterung über die kleine zufällige Zwiesprache hinweg. Immer ekstatischer, immer lauter, immer frenetischer wird das Gelage, und die Stunde steht schon bedenklich spät nach Mitternacht, da die Gäste das Haus des Bürgermeisters verlassen.
18
+
19
+ Es ist spät nach Mitternacht. Der 25. April, der für Straßburg so erregende Tag der Kriegserklärung, ist zu Ende, eigentlich hat der 26. April schon begonnen. Nächtliches Dunkel liegt über den Häusern; aber trügerisch ist dieses Dunkel, denn noch fiebert die Stadt vor Erregung. In den Kasernen rüsten die Soldaten zum Ausmarsch und manche der Vorsichtigen hinter verschlossenen Läden vielleicht schon heimlich zur Flucht. Auf den Straßen marschieren einzelne Peletons, dazwischen jagen die klappernden Hufe der Meldereiter, dann rasselt wieder ein schwerer Zug Artillerie heran, und immer wieder hallt monoton der Ruf der Schildwache von Posten zu Posten. Zu nahe ist der Feind, zu unsicher und zu erregt die Seele der Stadt, als daß sie Schlaf fände in so entscheidendem Augenblick.
20
+
21
+ Auch Rouget, der jetzt in sein bescheidenes Zimmerchen in der Grande Rue 126 die runde Treppe hinaufgeklettert ist, fühlt sich merkwürdig erregt. Er hat sein Versprechen nicht vergessen, möglichst rasch ein Marschlied, ein Kriegslied für die Rheinarmee zu versuchen. Unruhig stapft er in seinem engen Zimmer auf und nieder. Wie beginnen? Wie beginnen? Noch schwirren ihm alle die anfeuernden Rufe der Proklamationen, der Reden, der Toaste chaotisch durch den Sinn. »Aux armes, citoyens! ... Marchons, enfants de la liberté! ... Ecrasons la tyrannie! ... L'étendard de la guerre est déployé! ...« Aber auch der andern Worte entsinnt er sich, die er im Vorübergehen gehört, die Stimmen der Frauen, die um ihre Söhne zittern, die Sorge der Bauern, Frankreichs Felder könnten zerstampft werden und mit Blut gedüngt von den fremden Kohorten. Halb unbewußt schreibt er die ersten beiden Zeilen hin, die nur Widerhall, Widerklang, Wiederholung sind jener Anrufe.
22
+
23
+ »Allons, enfants de la patrie,
24
+
25
+ Le jour de gloire est arrivé!«
26
+
27
+ Dann hält er inne und stutzt. Das sitzt. Der Ansatz ist gut. Jetzt nur gleich den rechten Rhythmus finden, die Melodie zu den Worten. Er nimmt seine Geige vom Schrank, er probiert. Und wunderbar: gleich in den ersten Takten paßt sich der Rhythmus vollkommen den Worten an. Hastig schreibt er weiter, nun schon getragen, nun schon mitgerissen von der Kraft, die in ihn gefahren ist. Und mit einemmal strömt alles zusammen: alle die Gefühle, die sich in dieser Stunde entladen, alle die Worte, die er auf der Straße, die er bei dem Bankett gehört, der Haß gegen die Tyrannen, die Angst um die Heimaterde, das Vertrauen zum Siege, die Liebe zur Freiheit. Rouget braucht gar nicht zu dichten, zu erfinden, er braucht nur in Reime zu bringen, in den hinreißenden Rhythmus seiner Melodie die Worte zu setzen, die heute, an diesem einzigen Tage, von Mund zu Mund gegangen, und er hat alles ausgesprochen, alles ausgesagt, alles ausgesungen, was die Nation in innerster Seele empfand. Und er braucht nicht zu komponieren, denn durch die verschlossenen Fensterläden dringt der Rhythmus der Straße, der Stunde herein, dieser Rhythmus des Trotzes und der Herausforderung, der in dem Marschtritt der Soldaten, dem Schmettern der Trompeten, dem Rasseln der Kanonen liegt. Vielleicht vernimmt er ihn nicht selbst, nicht sein eigenes waches Ohr, aber der Genius der Stunde, der für diese einzige Nacht Hausung genommen hat in seinem sterblichen Leibe, hat ihn vernommen. Und immer fügsamer gehorcht die Melodie dem hämmernden, dem jubelnden Takt, der Herzschlag eines ganzen Volkes ist. Wie unter fremdem Diktat schreibt hastig und immer hastiger Rouget die Worte, die Noten hin – ein Sturm ist über ihn gekommen, wie er nie seine enge bürgerliche Seele durchbrauste. Eine Exaltation, eine Begeisterung, die nicht die seine ist, sondern magische Gewalt, zusammengeballt in eine einzige explosive Sekunde, reißt den armen Dilettanten hunderttausendfach über sein eigenes Maß hinaus und schleudert ihn wie eine Rakete – eine Sekunde lang Licht und strahlende Flamme – bis zu den Sternen. Eine Nacht ist es dem Kapitänleutnant Rouget de Lisle gegönnt, Bruder der Unsterblichen zu sein: aus den übernommenen, der Straße, den Journalen abgeborgten Rufen des Anfangs formt sich ihm schöpferisches Wort und steigt empor zu einer Strophe, die in ihrer dichterischen Formulierung so unvergänglich ist wie die Melodie unsterblich.
28
+
29
+ »Amour sacré de la patrie,
30
+
31
+ Conduis, soutiens nos bras vengeurs,
32
+
33
+ Liberté, liberté chérie,
34
+
35
+ Combats avec tes défenseurs.«
36
+
37
+ Dann noch eine fünfte Strophe, die letzte, und aus einer Erregung und in einem Guß gestaltet, vollkommen das Wort der Melodie verbindend, ist noch vor dem Morgengrauen das unsterbliche Lied vollendet. Rouget löscht das Licht und wirft sich hin auf sein Bett. Irgend etwas, er weiß nicht was, hat ihn aufgehoben in eine nie gefühlte Helligkeit seiner Sinne, irgend etwas schleudert ihn jetzt nieder in eine dumpfe Erschöpfung. Er schläft einen abgründigen Schlaf, der wie ein Tod ist. Und tatsächlich ist schon wieder der Schöpfer, der Dichter, der Genius in ihm gestorben. Auf dem Tische aber liegt, losgelöst von dem Schlafenden, den dies Wunder wahrhaft im heiligen Rausch überkommen, das vollendete Werk. Kaum ein zweites Mal in der Geschichte aller Völker und Zeiten ist ein Lied so rasch und so vollkommen gleichzeitig Wort und Musik geworden.
38
+
39
+ Dieselben Glocken vom Münster wie immer verkünden den neuen Morgen. Ab und zu trägt der Wind vom Rhein her Schüsse herüber, die ersten Geplänkel haben begonnen. Rouget erwacht. Mit Mühe tastet er sich aus dem Abgrund seines Schlafes empor. Etwas ist geschehen, fühlt er dumpf, etwas mit ihm geschehen, an das er nur dumpf sich erinnert. Dann erst bemerkt er auf dem Tisch das frischbeschriebene Blatt. Verse? Wann habe ich die geschrieben? Musik, in meiner eigenen Handschrift? Wann habe ich das komponiert? Ach ja, das Lied, das Freund Dietrich gestern erbeten, das Marschlied für die Rheinarmee! Rouget liest seine Verse, summt dazu die Melodie, fühlt aber, wie immer der Schöpfer vor dem eben geschaffenen Werk, sich völlig ungewiß. Aber nebenan wohnt ein Regimentskamerad, dem zeigt und singt er es vor. Der Freund scheint zufrieden und schlägt nur einige kleine Änderungen vor. An dieser ersten Zustimmung gewinnt Rouget ein gewisses Zutrauen. Mit der ganzen Ungeduld eines Autors und stolz auf sein rasch erfülltes Versprechen, fällt er gleich dem Bürgermeister Dietrich ins Haus, der im Garten seinen Morgenspaziergang macht und dabei eine neue Rede meditiert. Wie, Rouget? Schon fertig? Nun, da wollen wir gleich eine Probe abhalten. Die beiden gehen aus dem Garten in den Salon des Hauses, Dietrich setzt sich ans Klavier und spielt die Begleitung, Rouget singt den Text. Angelockt von der unerwarteten morgendlichen Musik kommt die Frau des Bürgermeisters ins Zimmer und verspricht, Kopien von dem neuen Lied zu machen und als gelernte Musikerin, die sie ist, gleich die Begleitung auszuarbeiten, damit man schon heute nacht bei der Abendgesellschaft es den Freunden des Hauses zwischen allerhand andern Liedern vorsingen könne. Der Bürgermeister Dietrich, stolz auf seine nette Tenorstimme, übernimmt es, das Lied nun gründlicher zu studieren, und am 26. April, am Abend desselben Tages, in dessen Morgenstunden das Lied gedichtet und komponiert war, wird es zum erstenmal einer zufällig gewählten Gesellschaft im Salon des Bürgermeisters vorgesungen.
40
+
41
+ Die Zuhörer scheinen freundlich applaudiert zu haben, und wahrscheinlich hat es an allerhand höflichen Komplimenten für den anwesenden Autor nicht gefehlt. Aber selbstverständlich hat nicht die leiseste Ahnung die Gäste des Hôtel de Broglie an dem großen Platz von Straßburg überkommen, daß mit unsichtbaren Flügeln eine ewige Melodie sich niedergeschwungen in ihre irdische Gegenwart. Selten begreifen die Zeitgenossen auf den ersten Blick die Größe eines Menschen oder die Größe eines Werkes, und wie wenig sich die Frau Bürgermeisterin jenes erstaunlichen Augenblicks bewußt wurde, beweist sie mit dem Brief an ihren Bruder, in dem sie ein Wunder zu einem gesellschaftlichen Ereignis banalisiert. »Du weißt, daß wir viele Leute im Haus empfangen und man immer etwas erfinden muß, um Abwechslung in die Unterhaltung zu bringen. Und so hat mein Mann die Idee gehabt, irgendein Gelegenheitslied komponieren zu lassen. Der Kapitän vom Ingenieurkorps, Rouget de Lisle, ein liebenswürdiger Dichter und Kompositeur, hat sehr schnell diese Musik eines Kriegsliedes gemacht. Mein Mann, der eine gute Tenorstimme hat, hat das Stück gleich gesungen, das sehr anziehend ist und eine gewisse Eigenart zeigt. Es ist ein besserer Gluck, lebendiger und belebter. Ich für mein Teil habe meine Begabung für Orchestrierung dabei angewandt und arrangierte die Partitur für Klavier und andere Instrumente, so daß ich viel zu arbeiten habe. Das Stück ist bei uns gespielt worden, zur großen Zufriedenheit der ganzen Gesellschaft.«
42
+
43
+ »Zur großen Zufriedenheit der ganzen Gesellschaft« – das scheint uns heute überraschend kühl. Aber der bloß freundliche Eindruck, die bloß laue Zustimmung ist verständlich, denn noch hat sich bei dieser ersten Darbietung die Marseillaise nicht wahrhaft in ihrer Kraft enthüllen können. Die Marseillaise ist kein Vortragsstück für eine behagliche Tenorstimme und nicht bestimmt, in einem kleinbürgerlichen Salon zwischen Romanzen und italienischen Arien mit einer einzelnen Singstimme vorgetragen zu werden. Ein Lied, das aufrauscht zu den hämmernden, federnden, fordernden Takten »Aux armes, citoyens«, wendet sich an eine Masse, eine Menge, und seine wahre Orchestrierung sind klirrende Waffen, schmetternde Fanfaren, marschierende Regimenter. Nicht für Zuhörer, für kühl sitzende und behaglich genießende, war sie gedacht, sondern für Mittäter, Mitkämpfer. Nicht einem einzelnen Sopran, einem Tenor ist sie zugesungen, sondern der tausendkehligen Masse, das vorbildliche Marschlied, Siegeslied, Todeslied, Heimatlied, Nationallied eines ganzen Volkes. Erst Begeisterung, aus der es zuerst geboren ward, wird dem Lied Rougets die begeisternde Gewalt verleihen. Noch hat das Lied nicht gezündet, noch haben in magischer Resonanz nicht die Worte, nicht die Melodie die Seele der Nation erreicht, noch kennt die Armee nicht ihr Marschlied, ihr Siegeslied, noch kennt die Revolution nicht ihren ewigen Päan.
44
+
45
+ Auch er selbst, dem über Nacht dieses Wunder geschehen, Rouget de Lisle, ahnt ebensowenig wie die andern, was er traumwandlerisch und von einem treulosen Genius geführt, in jener einen Nacht geschaffen. Er freut sich natürlich herzhaft, der brave, liebenswürdige Dilettant, daß die eingeladenen Gäste kräftig applaudieren, daß man ihn als Autor höflich komplimentiert. Mit der kleinen Eitelkeit eines kleinen Menschen sucht er diesen kleinen Erfolg in seinem kleinen Provinzkreise fleißig auszunützen. Er singt in den Kaffeehäusern seinen Kameraden die neue Melodie vor, er läßt Abschriften herstellen und schickt sie an die Generäle der Rheinarmee. Inzwischen hat auf Befehl des Bürgermeisters und Empfehlung der Militärbehörden das Straßburger Musikkorps das »Kriegslied für die Rheinarmee« einstudiert, und vier Tage später, beim Abmarsch der Truppen, spielt das Musikkorps der Straßburger Nationalgarde auf dem großen Platz den neuen Marsch. In patriotischer Weise erklärt sich auch der Straßburger Verleger bereit, den »Chant de guerre pour l'armée du Rhin« zu drucken, der respektvoll dem General Luckner von seinem militärischen Untergebenen gewidmet wird. Aber nicht ein einziger der Generäle der Rheinarmee denkt daran, die neue Weise beim Vormarsch wirklich spielen oder singen zu lassen, und so scheint, wie alle bisherigen Versuche Rougets, der Salonerfolg des »Allons, enfants de la patrie« ein Eintagserfolg, eine Provinzangelegenheit zu bleiben und als solche vergessen zu werden.
46
+
47
+ Aber nie läßt sich die eingeborene Kraft eines Werkes auf die Dauer verbergen oder verschließen. Ein Kunstwerk kann vergessen werden von der Zeit, es kann verboten werden und versargt, immer aber erzwingt sich das Elementare den Sieg über das Ephemere. Einen Monat, zwei Monate hört man nichts vom Kriegslied der Rheinarmee. Die gedruckten und handgeschriebenen Exemplare liegen und wandern herum in gleichgültigen Händen. Aber immer genügt es, wenn ein Werk auch nur einen einzigen Menschen wirklich begeistert, denn jede echte Begeisterung wird selber schöpferisch. Am andern Ende von Frankreich, in Marseille, gibt der Klub der Verfassungsfreunde am 22. Juni ein Bankett für die abmarschierenden Freiwilligen. An langer Tafel sitzen fünfhundert junge, feurige Menschen in ihren neuen Uniformen der Nationalgarde; in ihrem Kreise fiebert genau die gleiche Stimmung wie an dem 25. April in Straßburg, nur noch heißer, hitziger und leidenschaftlicher, dank dem südlichen Temperament der Marseiller, und nicht mehr so eitel siegesgewiß wie in jener ersten Stunde der Kriegserklärung. Denn nicht wie jene Generäle flunkerten, sind die revolutionären französischen Truppen gleich über den Rhein marschiert und überall mit offenen Armen empfangen worden. Im Gegenteil, der Feind ist tief ins französische Land vorgestoßen, die Freiheit ist bedroht, die Sache der Freiheit in Gefahr.
48
+
49
+ Plötzlich, inmitten des Festmahls, schlägt einer – er heißt Mireur und ist ein Medizinstudent von der Universität in Montpellier – an sein Glas und erhebt sich. Alle verstummen und blicken auf ihn. Man erwartet eine Rede und eine Ansprache. Aber statt dessen schwingt der junge Mensch die Rechte empor und stimmt ein Lied an, ein neues Lied, das sie alle nicht kennen und von dem niemand weiß, wie es in seine Hand geraten ist, »Allons, enfants de la patrie«. Und nun zündet der Funke, als wäre er in ein Pulverfaß gefallen. Gefühl und Gefühl, die ewigen Pole, haben sich berührt. Alle diese jungen Menschen, die morgen ausrücken, die für die Freiheit kämpfen wollen und für das Vaterland zu sterben bereit sind, empfinden ihren innersten Willen, ihren ureigensten Gedanken in diesen Worten ausgedrückt; unwiderstehlich reißt der Rhythmus sie auf in eine einhellige, ekstatische Begeisterung. Strophe um Strophe wird bejubelt, noch einmal, noch ein zweites Mal muß das Lied wiederholt werden, und schon ist die Melodie ihr eigen geworden, schon singen sie, erregt aufgesprungen, die Gläser erhoben, den Refrain donnernd mit. »Aux armes, citoyens! Formez vos bataillons!« Neugierig drängen von der Straße Menschen heran, um zu hören, was hier mit solcher Begeisterung gesungen wird, und schon singen sie selber mit; am nächsten Tage ist die Melodie auf tausend und zehntausend Lippen. Ein Neudruck verbreitet sie, und wie die fünfhundert Freiwilligen am 2. Juli abmarschieren, wandert das Lied mit ihnen. Wenn sie müde werden auf der Landstraße, wenn ihr Schritt schlapp wird, braucht nur einer die Hymne anzustimmen, und schon gibt ihr mitreißender, ihr vorwärtsreißender Takt ihnen allen erneuten Schwung. Wenn sie durch ein Dorf marschieren und staunend die Bauern, neugierig die Einwohner sich versammeln, stimmen sie es im Chore an. Es ist ihr Lied geworden, sie haben, ohne es zu wissen, daß es für die Rheinarmee bestimmt war, ohne zu ahnen, von wem und wann es gedichtet war, den Hymnus als den ihres Bataillons, als Bekenntnis ihres Lebens und Sterbens übernommen. Es gehört zu ihnen wie die Fahne, und in leidenschaftlichem Vormarsch wollen sie ihn über die Welt tragen.
50
+
51
+ Der erste große Sieg der Marseillaise – denn so wird die Hymne Rougets bald sich nennen – ist Paris. Am 30. Juni marschiert das Bataillon durch die Faubourgs ein, die Fahne voran und das Lied. Tausende und Zehntausende stehen und warten in den Straßen, um sie festlich zu empfangen, und wie die Marseiller nun anrücken, fünfhundert Männer, gleichsam aus einer Kehle zum Taktschritt das Lied singend und immer wieder singend, horcht die Menge auf. Was ist das für eine herrliche, hinreißende Hymne, welche die Marseiller da singen? Was für ein Fanfarenruf dies, der in alle Herzen fährt, begleitet vom prasselnden Trommelschlag, dies »Aux armes, citoyens!« Zwei Stunden später, drei Stunden später, und schon klingt der Refrain in allen Gassen wieder. Vergessen ist das »Ça ira«, vergessen die alten Märsche, die abgebrauchten Couplets: die Revolution hat ihre eigne Stimme erkannt, die Revolution hat ihr Lied gefunden.
52
+
53
+ Lawinenhaft wird nun die Verbreitung, unaufhaltsam der Siegeslauf. Auf den Banketten wird die Hymne gesungen, in den Theatern und Klubs, dann sogar in den Kirchen nach dem Tedeum und bald anstatt des Tedeum. In einem, in zwei Monaten ist die Marseillaise das Lied des Volkes geworden und der ganzen Armee. Servan, der erste republikanische Kriegsminister, erkennt mit klugem Blick die tonische, die exaltierende Kraft eines so einzigartigen nationalen Schlachtgesanges. In eiliger Ordre befiehlt er, daß hunderttausend Exemplare an alle Kommandos überstellt werden sollen, und in zwei oder drei Nächten ist das Lied des Unbekannten mehr verbreitet als alle Werke Moli��res, Racines und Voltaires. Kein Fest, das nicht mit der Marseillaise schließt, keine Schlacht, wo nicht vorerst die Regimentsmusiker das Kriegslied der Freiheit intonieren. Bei Jemappes und Nerwinden ordnen sich die Regimenter im Chorgesang zum entscheidenden Sturme, und die feindlichen Generäle, die nur mit dem alten Rezept der verdoppelten Branntweinration ihre Soldaten stimulieren können, sehen erschreckt, daß sie nichts der explosiven Kraft dieser »fürchterlichen« Hymne entgegenzusetzen haben, wenn sie, gleichzeitig von Tausenden und Tausenden gesungen, wie eine klingende, klirrende Welle gegen ihre eigenen Reihen stürmt. Über allen Schlachten Frankreichs schwebt nun, Unzählige mitreißend in Begeisterung und Tod, die Marseillaise, wie Nike, die geflügelte Göttin des Sieges.
54
+
55
+ Unterdessen sitzt in der kleinen Garnison von Hüningen ein höchst unbekannter Hauptmann des Festungswesens, Rouget, und entwirft brav Wälle und Verschanzungen. Vielleicht hat er schon das »Kriegslied der Rheinarmee« vergessen, das er in jener verschollenen Nacht des 26. April 1792 geschaffen, und wagt gar nicht zu ahnen, wenn er in den Gazetten von jener andern Hymne, jenem andern Kriegslied liest, das im Sturm Paris erobert, daß dieses sieghafte »Lied der Marseiller« Wort für Wort und Takt für Takt nichts anderes ist als das in ihm und an ihm geschehene Wunder jener Nacht. Denn grausame Ironie des Schicksals – in alle Himmel rauschend, zu den Sternen brausend, trägt diese Melodie nur einen einzigen Menschen nicht hoch, nämlich den Menschen, der sie ersonnen. Niemand in ganz Frankreich kümmert sich um den Hauptmann Rouget de Lisle, der riesigste Ruhm, den je ein Lied gekannt, bleibt dem Liede, und nicht ein Schatten davon fällt auf seinen Schöpfer Rouget. Sein Name wird nicht mitgedruckt auf den Texten, und er selbst bliebe völlig unbeachtet bei den Herren der Stunde, brächte er sich nicht selbst in ärgerliche Erinnerung. Denn – geniale Paradoxie, wie sie nur die Geschichte erfinden kann – der Schöpfer der Revolutionshymne ist kein Revolutionär; im Gegenteil: der wie kein anderer die Revolution durch sein unsterbliches Lied fortgetrieben, möchte sie mit allen Kräften nun wieder zurückdämmen. Als die Marseiller und der Pariser Pöbel – seinen Gesang auf den Lippen – die Tuilerien stürmen und man den König absetzt, hat Rouget de Lisle genug von der Revolution. Er weigert sich, den Eid auf die Republik zu leisten, und quittiert lieber seinen Dienst, als den Jakobinern zu dienen. Das Wort von der »liberté chérie«, der geliebten Freiheit, in seiner Hymne ist diesem aufrechten Manne kein leeres Wort: er verabscheut die neuen Tyrannen und Despoten im Konvent nicht minder, als er die gekrönten und gesalbten jenseits der Grenzen haßte. Offen macht er seinem Unmut gegen den Wohlfahrtsausschuß Luft, als sein Freund, der Bürgermeister Dietrich, der Pate der Marseillaise, als der General Luckner, dem sie gewidmet war, als alle die Offiziere und Adeligen, die an jenem Abend ihre ersten Zuhörer waren, auf die Guillotine geschleppt werden, und bald ereignet sich die groteske Situation, daß der Dichter der Revolution als Konterrevolutionär gefangengesetzt wird, daß man ihm, und gerade ihm den Prozeß macht mit der Anschuldigung, sein Vaterland verraten zu haben. Nur der 9. Thermidor, der mit dem Sturz Robespierres die Gefängnisse öffnet, hat der Französischen Revolution die Schmach erspart, den Dichter ihres unsterblichsten Liedes dem »nationalen Rasiermesser« überantwortet zu haben.
56
+
57
+ Immerhin, es wäre ein heldischer Tod gewesen und nicht ein so klägliches Verdämmern im Dunkel, wie es Rouget verhängt ist. Denn um mehr als vierzig Jahre, um Tausende und Tausende von Tagen überlebt der unglückliche Rouget den einzigen wirklich schöpferischen Tag seines Lebens. Man hat ihm die Uniform ausgezogen, man hat ihm die Pension gestrichen; die Gedichte, die Opern, die Texte, die er schreibt, werden nicht gedruckt, nicht gespielt. Das Schicksal verzeiht es dem Dilettanten nicht, sich unberufen in die Reihe der Unsterblichen eingedrängt zu haben. Mit allerhand kleinen und nicht immer sauberen Geschäften fristet der kleine Mann sein kleines Leben. Vergebens versuchen aus Mitleid Carnot und später Bonaparte, ihm zu helfen. Aber etwas in dem Charakter Rougets ist rettungslos vergiftet und verschroben geworden durch die Grausamkeit jenes Zufalls, der ihn Gott und Genius sein ließ drei Stunden lang und dann verächtlich wieder zurückwarf in die eigene Nichtigkeit. Er zankt und queruliert mit allen Mächten, er schreibt an Bonaparte, der ihm helfen wollte, freche und pathetische Briefe, er rühmt sich öffentlich, bei der Volksabstimmung gegen ihn gestimmt zu haben. Seine Geschäfte verwickeln ihn in dunkle Affären, und wegen eines unbezahlten Wechsels muß er sogar mit dem Schuldgefängnis St. Pelargie Bekanntschaft machen. Unbeliebt an allen Stellen, von Schuldnern gejagt, von der Polizei ständig bespitzelt, verkriecht er sich schließlich irgendwo in der Provinz, und wie aus einem Grabe, abgeschieden und vergessen, lauscht er von dort dem Schicksal seines unsterblichen Liedes; er erlebt es noch, daß die Marseillaise mit den siegreichen Armeen über alle Länder Europas stürmt, dann noch, daß Napoleon, kaum Kaiser geworden, sie als zu revolutionär aus allen Programmen streichen läßt, daß die Bourbonen sie dann gänzlich verbieten. Nur ein Staunen kommt den verbitterten Greis an, wie nach einem Menschenalter die Julirevolution 1830 seine Worte, seine Melodie in alter Kraft auferstehen läßt an den Barrikaden von Paris und der Bürgerkönig Louis Philippe ihm als dem Dichter ein kleines Pensiönchen verleiht. Wie ein Traum scheint es dem Verschollenen, dem Vergessenen, daß man sich seiner überhaupt noch erinnert, aber es ist nur ein kleines Erinnern mehr, und als der Sechsundsiebzigjährige endlich in Choisy-le-Roi 1836 stirbt, nennt und kennt niemand seinen Namen mehr. Abermals muß ein Menschenalter vergehen: erst im Weltkrieg, da die Marseillaise, längst Nationalhymnus geworden, an allen Fronten Frankreichs wieder kriegerisch erklingt, wird angeordnet, daß der Leichnam des kleinen Hauptmanns Rouget an derselben Stelle im Invalidendom bestattet werde wie der des kleinen Leutnants Bonaparte, und so ruht endlich der höchst unberühmte Schöpfer eines ewigen Liedes in der Ruhmeskrypta seines Vaterlandes von der Enttäuschung aus, nichts gewesen zu sein als der Dichter einer einzigen Nacht.
radio_mlbee/data/sternstunden04-en.txt ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ https://www.deepl.com/translator machine translated
2
+
3
+ The genius of a night
4
+
5
+ The Marseillaise, April 25, 1792
6
+
7
+ The genius of one night
8
+
9
+ In 1792, two months, three months already, the French National Assembly is wavering over the decision: war against the coalition of emperors and kings or peace. Louis XVI is himself undecided; he senses the danger of a victory for the revolutionaries, he senses the danger of their defeat. The parties are also uncertain. The Girondists are pushing for war to retain power, Robespierre and the Jacobins are fighting for peace to seize power themselves in the meantime. Day by day the situation becomes more tense, the journals clamor, the clubs discuss, ever wilder the rumors buzz, and ever more public opinion is aroused by them. As always a decision, it therefore becomes a kind of liberation, as on April 20 the King of France finally declares war on the Emperor of Austria and the King of Prussia.
10
+
11
+ During these weeks and weeks the electric tension has lain over Paris, weighing heavily and disturbing the soul; but the excitement in the border towns is even more oppressive, even more threatening. Troops are already assembled in all bivouacs, volunteers and national guards are being equipped in every village, in every town, fortifications are being repaired everywhere, and especially in Alsace it is known that on its soil, as always between France and Germany, the first decision will be made. On the banks of the Rhine, the enemy, the adversary, is not, as in Paris, a blurred, a pathetic-rhetorical concept, but a visible, sensuous presence; for at the fortified bridgehead, from the tower of the cathedral, the approaching Prussian regiments can be perceived with the naked eye. At night the wind carries the rolling of the enemy artillery wagons, the clanking of weapons, the trumpet signals across the stream glittering indifferently in the moonlight. And everyone knows: only one word, only one decree is needed, and from the silent mouth of the Prussian cannons thunder and lightning will fly, and the thousand-year struggle between Germany and France will have begun once again - this time in the name of the new freedom on the one side and in the name of the old order on the other.
12
+
13
+ It was an incomparable day when, on April 25, 1792, the news of the declaration of war was brought from Paris to Strasbourg by convoys. Immediately the people streamed out of all the streets and houses into the open squares, ready for war the whole garrison marched to the last parade, regiment after regiment. On the main square, Mayor Dietrich awaits them, the tricolor sash around his body, the cockade on his hat, which he waves in greeting to the soldiers. The call of the fanfare and the roll of the drums call for silence. In a loud voice, Dietrich reads the text of the declaration of war in French and German in this and all other places in the city. After his last words the regimental musicians intoned the first, the preliminary war song of the revolution, the "Ça ira", actually a sparkling, high-spirited, mocking dance melody, but the clashing, the thundering steps of the marching out regiments gave it a martial beat. Then the crowd disperses, carrying the fanned enthusiasm into all the alleys and houses; in the cafes, in the clubs, inflammatory speeches are made and proclamations distributed. "Aux armes, citoyens! L'étendard de la guerre est déployé! Le signal est donné!"; thus and with similar calls they begin, and everywhere, in all the speeches, in all the newspapers, on all the posters, on all the lips, are repeated such punchy, rhythmic cries as "Aux armes, citoyens!". Qu'ils tremblent donc, les despotes couronnés! Marchons, enfants de la liberté!", and each time the masses cheer and cheer to the fiery words.
14
+
15
+ The great masses in the streets and squares always cheer when war is declared, but other voices, quieter, more distant voices, always stir in such moments of street jubilation; fear, too, worry, too, wakes up at a declaration of war, only it whispers secretly in the parlors or remains silent with a pale lip. Eternally and everywhere are mothers who say to themselves: Will the foreign soldiers not murder my children; in all countries are the peasants who worry about their possessions, their fields, their huts, their cattle and their harvest. Will not their seed be trampled, their house plundered by the brutal hordes, not fertilized with blood the fields of their labors? But the mayor of Strasbourg, Frederick Baron Dietrich, actually an aristocrat, but like the best aristocracy of France at that time devoted to the cause of the new freedom with all his soul, wants only the loud, the ringing voices of confidence to speak; consciously he turns the day of the declaration of war into a public celebration. With his sash across his chest, he hurried from one meeting to another to cheer the people. He distributes wine and food to the departing soldiers, and in the evening he gathers the generals, the officers and the most important officials in his spacious house on the Place de Broglie for a farewell party, to which the enthusiasm already gives the character of a victory celebration. The generals, confident of victory as always generals, preside, the young officers, who see in the war the meaning of their lives fulfilled, have free word. One cheers the other. They swing their sabers, they embrace, they drink to each other, they make passionate and increasingly passionate speeches over good wine. And again the same stimulating words of the journals and proclamations recur in all the speeches: "To arms, citizens! Let us march! Let us save the fatherland! Soon they will tremble, the crowned despots. Now that the flag of victory has unfurled, the day has come to carry the tricolor over the world! Everyone must give his best now, for the king, for the flag, for freedom!" The whole people, the whole country at such moments wants to become a sacred unity through faith in victory and enthusiasm for the cause of freedom.
16
+
17
+ Suddenly, in the midst of talking and toasting, Mayor Dietrich turned to a young captain from the fortress corps, named Rouget, sitting at his side. He remembered that half a year ago, on the occasion of the proclamation of the Constitution, this nice officer, not exactly handsome but sympathetic, had written a rather nice hymn to liberty, which the regimental musician Pleyel immediately set to music. The unpretentious work had proved to be singable, the military band had learned it, it had been played in the public square and sung in the choir. Wouldn't the declaration of war and the departure be a good occasion to stage a similar celebration? So Mayor Dietrich casually asks, as one would ask a good acquaintance for a favor, Captain Rouget (who has quite unjustifiably ennobled himself and calls himself Rouget de Lisle), whether he would not like to take advantage of the patriotic occasion and compose something for the marching troops, a war song for the Rhine army, which is to march out against the enemy tomorrow.
18
+
19
+ Rouget, a modest, insignificant man who never considered himself a great composer - his verses were never printed, his operas refüsiert - knows that occasional verses flow easily into his pen. To please the high official and the good friend, he declares himself ready. Yes, he wants to try. "Bravo, Rouget," a general from across the street drinks to him and admonishes him that he should then immediately send the song after him into the field; the Rhine Army could really use some step-winging, patriotic marching song. In the meantime, someone else begins to make a speech. Again there is toasting, noise, drinking. With a strong wave the general enthusiasm goes over the small coincidental dialogue. The revelry becomes more and more ecstatic, louder and louder, more and more frenetic, and the hour is already precariously late after midnight, when the guests leave the mayor's house.
20
+
21
+ It is late after midnight. April 25, the day of the declaration of war, which was so exciting for Strasbourg, has come to an end; in fact, April 26 has already begun. Nightly darkness lies over the houses; but this darkness is deceptive, for the city is still feverish with excitement. In the barracks, the soldiers are preparing to march out, and some of the cautious ones are perhaps already secretly fleeing behind closed shutters. In the streets, individual peletons march, the clattering hooves of the dispatch riders hunt between them, then another heavy platoon of artillery rattles up, and again and again the call of the shield guard echoes monotonously from post to post. The enemy is too close, the soul of the city too uncertain and too excited to find sleep at such a decisive moment.
22
+
23
+ Rouget, who has now climbed the circular staircase to his modest little room at 126 Grande Rue, also feels strangely aroused. He has not forgotten his promise to attempt as quickly as possible a marching song, a war song for the Rhine Army. Restlessly he trudges up and down his narrow room. How to begin? How to begin? All the cheering shouts of the proclamations, the speeches, the toasts are still whirring chaotically through his mind. "Aux armes, citoyens! ... Marchons, enfants de la liberté! ... Ecrasons la tyrannie! ... L'étendard de la guerre est déployé! ..." But he also remembers the other words he heard in passing, the voices of women trembling for their sons, the concern of the peasants that France's fields might be trampled and fertilized with blood by the foreign cohorts. Half unconsciously, he writes down the first two lines, which are only echoes, reverberations, repetitions of those calls.
24
+
25
+ "Allons, enfants de la patrie,
26
+
27
+ Le jour de gloire est arrivé!"
28
+
29
+ Then he pauses and pauses. It sits. The approach is good. Now just find the right rhythm, the melody to the words. He takes his violin from the cabinet, tries it out. And wonderful: in the very first bars, the rhythm adapts perfectly to the words. Hastily he continues to write, now already carried along, now already carried away by the power that has entered him. And all at once everything flows together: all the feelings that are discharged in this hour, all the words that he heard on the street, that he heard at the banquet, the hatred against the tyrants, the fear for the native soil, the confidence for victory, the love for freedom. Rouget does not even need to write poetry, to invent, he only needs to put into rhyme, into the ravishing rhythm of his melody, the words that today, on this single day, have passed from mouth to mouth, and he has spoken everything, said everything, sung everything that the nation felt in its innermost soul. And he does not need to compose, because through the closed shutters penetrates the rhythm of the street, of the hour, this rhythm of defiance and challenge, which lies in the marching of the soldiers, the blare of the trumpets, the rattle of the cannons. Perhaps he does not hear it himself, not his own alert ear, but the genius of the hour, who has taken up residence in his mortal body for this single night, has heard it. And more and more docilely the melody obeys the hammering, the jubilant beat, which is the heartbeat of a whole people. As if under foreign dictation, Rouget hastily and ever more hastily writes down the words, the notes - a storm has come over him, such as has never raged through his narrow bourgeois soul. An exaltation, an enthusiasm that is not his own, but magical force, concentrated into a single explosive second, sweeps the poor dilettante a hundred thousand times beyond his own measure and hurls him like a rocket - for a second light and radiant flame - to the stars. One night it is granted to Lieutenant-Captain Rouget de Lisle to be brother of the immortals: from the adopted shouts of the beginning, borrowed from the street, from the journals, creative word forms itself to him and rises to a stanza which in its poetic formulation is as immortal as the melody is immortal.
30
+
31
+ "Amour sacré de la patrie,
32
+
33
+ Conduis, soutiens nos bras vengeurs,
34
+
35
+ Liberté, liberté chérie,
36
+
37
+ Combats avec tes défenseurs."
38
+
39
+ Then a fifth stanza, the last, and formed from one excitement and in one cast, perfectly uniting the word of the melody, the immortal song is completed before dawn. Rouget extinguishes the light and lies down on his bed. Something, he does not know what, has lifted him up into a never felt brightness of his senses, something now hurls him down into a dull exhaustion. He sleeps an abysmal sleep, which is like a death. And indeed the creator, the poet, the genius in him has died again. But on the table, detached from the sleeper, whom this miracle truly overcomes in holy intoxication, lies the completed work. Hardly a second time in the history of all peoples and times has a song become word and music so quickly and so perfectly at the same time.
40
+
41
+ The same bells from the minster as always announce the new morning. Now and then the wind carries shots from the Rhine, the first skirmishes have begun. Rouget wakes up. With difficulty he gropes his way up from the abyss of his sleep. Something has happened, he feels dully, something has happened to him that he remembers only dully. Only then does he notice the freshly written page on the table. Verses? When did I write these? Music, in my own handwriting? When did I compose that? Oh yes, the song that friend Dietrich asked for yesterday, the marching song for the Rhine army! Rouget reads his verses, hums the melody to it, but feels, as always the creator before the just created work, completely uncertain. But next door lives a regimental comrade, to whom he shows and sings it. The friend seems satisfied and suggests only a few minor changes. Rouget gains a certain confidence from this first approval. With all the impatience of an author and proud of his quickly fulfilled promise, he immediately falls in with Mayor Dietrich, who is taking his morning walk in the garden, meditating on a new speech. How, Rouget? Already ready? Well, let's have a rehearsal right away. The two walk out of the garden into the parlor of the house, Dietrich sits down at the piano and plays the accompaniment, Rouget sings the text. Attracted by the unexpected morning music, the mayor's wife comes into the room and promises to make copies of the new song and, being a trained musician, to work out the accompaniment right away, so that it can be sung to the friends of the house among all sorts of other songs at the evening party tonight. The mayor Dietrich, proud of his nice tenor voice, took it upon himself to study the song more thoroughly, and on April 26, in the evening of the same day, in the morning hours of which the song was composed, it was sung for the first time to a randomly chosen company in the mayor's salon.
42
+
43
+ The audience seems to have applauded kindly, and probably there was no lack of all kinds of polite compliments for the present author. But, of course, not the slightest inkling came over the guests of the Hôtel de Broglie in the great square of Strasbourg that with invisible wings an eternal melody had swooped down into their earthly presence. Rarely do contemporaries comprehend at first sight the greatness of a man or the greatness of a work, and how little the Lady Mayoress became aware of that amazing moment she proves with the letter to her brother in which she trivializes a miracle into a social event. "You know that we receive many people in the house and it is always necessary to invent something to bring variety to the entertainment. And so my husband had the idea of having some occasional song composed. The captain of the Corps of Engineers, Rouget de Lisle, a kind poet and composer, very quickly made this music of a war song. My husband, who has a good tenor voice, immediately sang the piece, which is very attractive and shows a certain peculiarity. It is a better Gluck, more lively and animated. For my part, I applied my talent for orchestration to it and arranged the score for piano and other instruments, so I have a lot to work with. The piece has been played in our house, to the great satisfaction of the whole company."
44
+
45
+ "To the great satisfaction of the whole society" - that seems surprisingly cool to us today. But the merely friendly impression, the merely lukewarm approval is understandable, for the Marseillaise has not yet been able to truly reveal its power in this first performance. The Marseillaise is not a recital piece for a comfortable tenor voice and is not meant to be performed in a petty bourgeois salon between romances and Italian arias with a single singing voice. A song that roars to the pounding, bouncing, demanding bars of "Aux armes, citoyens" addresses a mass, a crowd, and its true orchestration is clashing arms, blaring fanfares, marching regiments. It was not meant for listeners, for the coolly seated and comfortably enjoying, but for accomplices, fellow fighters. It was not sung to a single soprano or tenor, but to the thousand-throated masses, the exemplary marching song, victory song, death song, homeland song, national song of an entire people. Only enthusiasm, from which it was first born, will give Rouget's song its inspiring power. The song has not yet ignited, the words have not yet magically resonated, the melody has not yet reached the soul of the nation, the army does not yet know its marching song, its victory song, the revolution does not yet know its eternal paean.
46
+
47
+ Even he himself, to whom this miracle happened overnight, Rouget de Lisle, has as little idea as the others what he created in that one night, somnambulistically and guided by a faithless genius. He is of course heartily pleased, the good, amiable dilettante, that the invited guests applaud vigorously, that he is politely complimented as an author. With the small vanity of a small person, he seeks to make diligent use of this small success in his small provincial circle. He sings the new melody to his comrades in the coffee houses, he has copies made and sends them to the generals of the Rhine army. In the meantime, on the order of the mayor and the recommendation of the military authorities, the Strasbourg music corps rehearsed the "War Song for the Army of the Rhine", and four days later, at the departure of the troops, the music corps of the Strasbourg National Guard played the new march in the large square. In patriotic fashion, the Strasbourg publisher also agrees to print the "Chant de guerre pour l'armée du Rhin", which is respectfully dedicated to General Luckner by his military subordinate. But not a single one of the generals of the Rhine army thinks of actually having the new tune played or sung during the advance, and so, like all Rouget's previous attempts, the salon success of "Allons, enfants de la patrie" seems to remain a one-day success, a provincial affair, and to be forgotten as such.
48
+
49
+ But the innate power of a work can never be concealed or closed off in the long run. A work of art can be forgotten by time, it can be forbidden and become stale, but the elemental always forces its way to victory over the ephemeral. One month, two months nothing is heard of the war song of the Rhine army. The printed and handwritten copies lie and wander around in indifferent hands. But it is always enough if a work really inspires even a single person, for every genuine enthusiasm itself becomes creative. At the other end of France, in Marseille, the Club of the Friends of the Constitution held a banquet for the marching volunteers on June 22. Five hundred young, fiery people in their new uniforms of the National Guard were seated at a long table; in their circle exactly the same mood as on April 25 in Strasbourg, only even hotter, more heated and more passionate, thanks to the southern temperament of the people of Marseilles, and no longer so vainly confident of victory as in that first hour of the declaration of war. For not, as those generals fibbed, have the revolutionary French troops marched straight across the Rhine and been welcomed everywhere with open arms. On the contrary, the enemy has advanced deep into the French countryside, freedom is threatened, the cause of liberty is in danger.
50
+
51
+ Suddenly, in the midst of the feast, one - his name is Mireur and he is a medical student from the University of Montpellier - strikes his glass and rises. Everyone falls silent and looks at him. One expects a speech and an address. But instead, the young man swings up his right hand and intones a song, a new song that they all don't know and no one knows how it got into his hand, "Allons, enfants de la patrie." And now the spark ignites as if it had fallen into a powder keg. Feeling and emotion, the eternal poles, have touched. All these young people who are going out tomorrow, who want to fight for freedom and are ready to die for the fatherland, feel their innermost will, their very own thoughts expressed in these words; irresistibly the rhythm sweeps them up into a unanimous, ecstatic enthusiasm. Verse after verse is cheered, once again, a second time the song must be repeated, and already the melody has become their own, already they sing, excitedly jumping up, glasses raised, the refrain thundering along. "Aux armes, citoyens! Formez vos bataillons!" Curious people crowd in from the street to hear what is being sung here with such enthusiasm, and already they are singing along themselves; the next day the melody is on a thousand and ten thousand lips. A reprint spreads it, and as the five hundred volunteers march off on July 2, the song travels with them. When they get tired on the road, when their step becomes slack, only one person needs to sing the hymn, and its rousing, its forward-rushing beat gives them all renewed momentum. When they march through a village and the peasants gather in amazement, the inhabitants curious, they sing it in chorus. It has become their song, they have, without knowing that it was intended for the Rhine Army, without suspecting by whom and when it was composed, adopted the hymn as that of their battalion, as a confession of their life and death. It belongs to them like the flag, and in passionate advance they want to carry it over the world.
52
+
53
+ The first great victory of the Marseillaise - for that is what Rouget's anthem will soon call itself - is Paris. On June 30, the battalion marches in through the faubourgs, flag in front and song. Thousands and tens of thousands stand and wait in the streets to receive them festively, and as the Marseillers now approach, five hundred men, singing as it were from one throat to the beat of the song and singing it again and again, the crowd listens. What is this magnificent, ravishing hymn that the people of Marseilles are singing? What a fanfare this, driving into all hearts, accompanied by the pattering drumbeat, this "Aux armes, citoyens!" Two hours later, three hours later, and already the refrain resounds in all alleys again. Forgotten is the "Ça ira," forgotten the old marches, the worn-out couplets: the revolution has recognized its own voice, the revolution has found its song.
54
+
55
+
56
+ The spread of the hymn became avalanche-like, the triumphant run unstoppable. The hymn is sung at banquets, in theaters and clubs, then even in churches after the Tedeum and soon instead of the Tedeum. In one, in two months the Marseillaise has become the song of the people and of the whole army. Servan, the first republican minister of war, recognizes with a wise eye the tonic, the exalting power of such a unique national battle song. In hasty order he commands that a hundred thousand copies be sent to all commands, and in two or three nights the Song of the Unknown is more widespread than all the works of Molière, Racine, and Voltaire. No feast that does not close with the Marseillaise, no battle where regimental musicians do not for the time being intone the war song of freedom. At Jemappes and Nerwinden, the regiments arrange themselves in choral song for the decisive storm, and the enemy generals, who can only stimulate their soldiers with the old recipe of doubled brandy rations, see with fright that they have nothing to oppose the explosive force of this "terrible" hymn when, sung simultaneously by thousands and thousands, it rushes against their own ranks like a ringing, clashing wave. Over all the battles of France now floats, sweeping countless into enthusiasm and death, the Marseillaise, like Nike, the winged goddess of victory.
57
+
58
+ Meanwhile, in the small garrison of Hüningen, a most unknown captain of fortifications, Rouget, sits dutifully designing ramparts and entrenchments. Perhaps he has already forgotten the "War Song of the Rhine Army" that he created on that lost night of April 26, 1792, and does not even dare to suspect, when he reads in the gazettes about that other hymn, that other war song that takes Paris by storm, that this victorious "Song of the Marseilles" is word for word and measure for measure nothing other than the miracle of that night that happened in him and to him. For cruel irony of fate - rushing to all heavens, roaring to the stars, this melody does not carry high only one person, namely the person who devised it. Nobody in all France cares about Captain Rouget de Lisle, the most enormous fame ever known to a song remains to the song, and not a shadow of it falls on its creator Rouget. His name is not printed on the texts, and he himself would remain completely unnoticed by the masters of the hour, if he did not bring himself into annoying memory. For - ingenious paradox as only history can invent it - the creator of the revolutionary hymn is not a revolutionary; on the contrary: he who, like no other, drove the revolution on through his immortal song, now wants to curb it back with all his might. When the people of Marseilles and the Parisian mob - his song on their lips - storm the Tuileries and the king is deposed, Rouget de Lisle has had enough of the revolution. He refuses to take the oath of allegiance to the Republic and resigns rather than serve the Jacobins. The word of "liberté chérie", the beloved liberty, in his hymn is not an empty word to this upright man: he detests the new tyrants and despots in the Convention no less than he hated those crowned and anointed beyond the borders. He openly gives vent to his displeasure against the Welfare Committee when his friend, Mayor Dietrich, the godfather of the Marseillaise, when General Luckner, to whom it was dedicated, when all the officers and nobles who were their first listeners that evening are dragged to the guillotine, and soon the grotesque situation occurs that the poet of the Revolution is imprisoned as a counter-revolutionary, that he, and he of all people, is put on trial with the accusation of having betrayed his fatherland. Only the 9th Thermidor, which opened the prisons with the fall of Robespierre, spared the French Revolution the ignominy of having handed over the poet of its most immortal song to the "national razor".
59
+
60
+ At least, it would have been a heroic death and not such a miserable twilight in the darkness as Rouget is imposed. For by more than forty years, by thousands and thousands of days, the unfortunate Rouget survives the only truly creative day of his life. His uniform has been taken off, his pension has been cancelled; the poems, the operas, the texts he writes are not printed, not performed. The fate does not forgive the dilettante for having entered the ranks of the immortals without being called. With all kinds of small and not always clean business the little man ekes out his small life. In vain, Carnot and later Bonaparte try to help him out of pity. But something in Rouget's character has become irredeemably poisoned and twisted by the cruelty of that coincidence which let him be God and genius for three hours and then contemptuously threw him back into his own nothingness. He quarrels and crosses with all powers, he writes insolent and pathetic letters to Bonaparte, who wanted to help him, he boasts publicly that he voted against him in the referendum. His business entangles him in dark affairs, and because of an unpaid bill of exchange he even has to make acquaintance with the debtors' prison St. Pelargie. Unpopular in all places, hounded by debtors, constantly spied on by the police, he finally holes up somewhere in the provinces, and as if from a grave, secluded and forgotten, he listens from there to the fate of his immortal song; he still experiences that the Marseillaise storms with the victorious armies over all the countries of Europe, then still that Napoleon, hardly emperor, has it deleted from all programs as too revolutionary, that the Bourbons then ban it completely. The embittered old man is only amazed when, after an age, the July Revolution of 1830 resurrects his words and his melody in their old strength at the barricades of Paris, and the bourgeois king Louis Philippe grants him a small pensium as a poet. It seems like a dream to the lost, the forgotten, that he is remembered at all, but it is only a small remembrance, and when the seventy-six-year-old finally dies in Choisy-le-Roi in 1836, no one calls or knows his name anymore. Once again, an age must pass: Only in the World War, when the Marseillaise, which had long since become the national anthem, resounds again in war on all fronts of France, is it ordered that the body of the little Captain Rouget be buried in the same place in the Invalides Cathedral as that of the little Lieutenant Bonaparte, and so at last the most unfamous creator of an eternal song rests in the crypt of glory of his fatherland from the disappointment of having been nothing but the poet of a single night.
61
+
radio_mlbee/data/test-en.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Wuthering Heights
2
+
3
+
4
+ --------------------------------------------------------------------------------
5
+
6
+ Chapter 2
7
+
8
+ Chinese
9
+
10
+
11
+ Yesterday afternoon set in misty and cold. I had half a mind to spend it by my study fire, instead of wading through heath and mud to Wuthering Heights. On coming up from dinner, however (N.B. I dine between twelve and one o'clock; the housekeeper, a matronly lady, taken as a fixture along with the house, could not, or would not, comprehend my request that I might be served at five), on mounting the stairs with this lazy intention, and stepping into the room, I saw a servant girl on her knees surrounded by brushes and coal-scuttles, and raising an infernal dust as she extinguished the flames with heaps of cinders. This spectacle drove me back immediately; I took my hat, and, after a four-miles' walk, arrived at Heathcliff's garden gate just in time to escape the first feathery flakes of a snow shower.
12
+
13
+ On that bleak hill top the earth was hard with a black frost, and the air made me shiver through every limb. Being unable to remove the chain, I jumped over, and, running up the flagged causeway bordered with straggling gooseberry bushes, knocked vainly for admittance, till my knuckles tingled and the dogs howled.
14
+
15
+ `Wretched inmates!' I ejaculated mentally, `you deserve perpetual isolation from your species for your churlish inhospitality. At least, I would not keep my doors barred in the day time. I don't care--I will get in!' So resolved, I grasped the latch and shook it vehemently. Vinegar-faced Joseph projected his head from a round window of the barn.
16
+
17
+ `Whet are ye for?' he shouted. `T' maister's dahn i' t' fowld. Go rahnd by th' end ut' laith, if yah went tuh spake tull him.'
18
+
19
+ `Is there nobody inside to open the door?' I hallooed, responsively.
20
+
21
+ `They's nobbut t' missis; and shoo'll nut oppen't an ye mak yer flaysome dins till neeght.'
22
+
23
+ `Why? Cannot you tell her who I am, eh, Joseph?'
24
+
25
+ `Nor-ne me! Aw'll hae noa hend wi't,' muttered the head, vanishing.
26
+
27
+ The snow began to drive thickly. I seized the handle to essay another trial; when a young man without coat, and shouldering a pitchfork, appeared in the yard behind. He hailed me to follow him, and, after marching through a wash-house, and a paved area containing a coal shed, pump, and pigeon cot, we at length arrived in the huge, warm, cheerful apartment, where I was formerly received. It glowed delightfully in the radiance of an immense fire, compounded of coal, peat, and wood; and near the table, laid for a plentiful evening meal, I was pleased to observe the `missis', an individual whose existence I had never previously suspected. I bowed and waited, thinking she would bid me take a seat. She looked at me, leaning back in her chair, and remained motionless and mute.
28
+
29
+ `Rough weather!' I remarked. `I'm afraid, Mrs Heathcliff, the door must bear the consequence of your servants' leisure attendance: I had hard work to make them hear me.'
30
+
31
+ She never opened her mouth. I stared--she stared also: at any rate, she kept her eyes on me in a cool, regardless manner, exceedingly embarrassing and disagreeable.
32
+
33
+ `Sit down,' said the young man gruffly. `He'll be in soon.'
34
+
35
+ I obeyed; and hemmed, and called the villain Juno, who deigned, at this second interview, to move the extreme tip of her tail, in token of owning my acquaintance.
36
+
37
+ `A beautiful animal!' I commenced again. `Do you intend parting with the little ones, madam?'
38
+
39
+ `They are not mine,' said the amiable hostess, more repellingly than Heathcliff himself could have replied.
40
+
41
+ `Ah, your favourites are among these?' I continued, turning to an obscure cushion full of something like cats.
42
+
43
+ `A strange choice of favourites!' she observed scornfully.
44
+
45
+ Unluckily, it was a heap of dead rabbits. I hemmed once more, and drew closer to the hearth, repeating my comment on the wildness of the evening.
46
+
47
+ `You should not have come out,' she said, rising and reaching from the chimney-piece two of the painted canisters.
48
+
49
+ Her position before was sheltered from the light; now, I had a distinct view of her whole figure and countenance. She was slender, and apparently scarcely past girlhood: an admirable form, and the most exquisite little face that I have ever had the pleasure of beholding; small features, very fair; flaxen ringlets, or rather golden, hanging loose on her delicate neck; and eyes, had they been agreeable in expression, they would have been irresistible: fortunately for my susceptible heart, the only sentiment they evinced hovered between scorn, and a kind of desperation, singularly unnatural to be detected there. The canisters were almost out of her reach; I made a motion to aid her; she turned upon me as a miser might turn if anyone attempted to assist him in counting his gold.
50
+
51
+ `I don't want your help,' she snapped; `I can get them for myself.'
52
+
53
+ `I beg your pardon!' I hastened to reply.
54
+
55
+ `Were you asked to tea?' she demanded, tying an apron over her neat black frock, and standing with a spoonful of the leaf poised over the pot.
56
+
57
+ `I shall be glad to have a cup,' I answered.
58
+
59
+ `Were you asked?' she repeated.
60
+
61
+ `No,' I said, half smiling. `You are the proper person to ask me.'
62
+  
63
+
64
+
65
+ Contents PreviousChapter
66
+ NextChapter
67
+
68
+
69
+ Homepage
radio_mlbee/data/test-zh.txt ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 呼啸山庄
2
+
3
+ --------------------------------------------------------------------------------
4
+
5
+ 第二章
6
+
7
+ 英文
8
+
9
+
10
+ 昨天下午又冷又有雾。我想就在书房炉边消磨一下午,不想踩着杂草污泥到呼啸山庄了。
11
+
12
+ 但是,吃过午饭(注意——我在十二点与一点钟之间吃午饭,而可以当作这所房子的附属物的管家婆,一位慈祥的太太却不能,或者并不愿理解我请求在五点钟开饭的用意),在我怀着这个懒惰的想法上了楼,迈进屋子的时候,看见一个女仆跪在地上,身边是扫帚和煤斗。她正在用一堆堆煤渣封火,搞起一片弥漫的灰尘。这景象立刻把我赶回头了。我拿了帽子,走了四里路,到达了希刺克厉夫的花园口口,刚好躲过了一场今年初降的鹅毛大雪。
13
+
14
+ 在那荒凉的山顶上,土地由于结了一层黑冰而冻得坚硬,冷空气使我四肢发抖。我弄不开门链,就跳进去,顺着两边种着蔓延的醋栗树丛的石路跑去。我白白地敲了半天门,一直敲到我的手指骨都痛了,狗也狂吠起来。
15
+
16
+ “倒霉的人家!”我心里直叫,“只为你这样无礼待客,就该一辈子跟人群隔离。我至少还不会在白天把门闩住。我才不管呢——我要进去!”如此决定了。我就抓住门闩,使劲摇它。苦脸的约瑟夫从谷仓的一个圆窗里探出头来。
17
+
18
+ “你干吗?”他大叫。“主人在牛栏里,你要是找他说话,就从这条路口绕过去。”
19
+
20
+ “屋里没人开门吗?”我也叫起来。
21
+
22
+ “除了太太没有别人。你就是闹腾到夜里,她也不会开。”
23
+
24
+ “为什么?你就不能告诉她我是谁吗,呃,约瑟夫?”
25
+
26
+ “别找我!我才不管这些闲事呢,”这个脑袋咕噜着,又不见了。
27
+
28
+ 雪开始下大了。我握住门柄又试一回。这时一个没穿外衣的年轻人,扛着一根草耙,在后面院子里出现了。他招呼我跟着他走,穿过了一个洗衣房和一片铺平的地,那儿有煤棚、抽水机和鸽笼,我们终于到了我上次被接待过的那间温暖的、热闹的大屋子。煤、炭和木材混合在一起燃起的熊熊炉火,使这屋子放着光彩。在准备摆上丰盛晚餐的桌旁,我很高兴地看到了那位“太太”,以前我从未料想到会有这么一个人存在的。我鞠躬等候,以为她会叫我坐下。她望望我,往她的椅背一靠,不动,也不出声。
29
+
30
+ “天气真坏!”我说,“希刺克厉夫太太,恐怕大门因为您的仆人偷懒而大吃苦头,我费了好大劲才使他们听见我敲门!”
31
+
32
+ 她死不开口。我瞪眼——她也瞪眼。反正她总是以一种冷冷的、漠不关心的神气盯住我,使人十分窘,而且不愉快。
33
+
34
+ “坐下吧,”那年轻人粗声粗气地说,“他就要来了。”
35
+
36
+ 我服从了;轻轻咳了一下,叫唤那恶狗朱诺。临到第二次会面,它总算赏脸,摇起尾巴尖,表示认我是熟人了。
37
+
38
+ “好漂亮的狗!”我又开始说话。“您是不是打算不要这些小的呢,夫人?”
39
+
40
+ “那些不是我的,”这可爱可亲的女主人说,比希刺克厉夫本人所能回答的腔调还要更冷淡些。
41
+
42
+ “啊,您所心爱的是在这一堆里啦!”我转身指着一个看不清楚的靠垫上那一堆像猫似的东西,接着说下去。
43
+
44
+ “谁会爱这些东西那才怪呢!”她轻蔑地说。
45
+
46
+ 倒霉,原来那是堆死兔子。我又轻咳一声,向火炉凑近些,又把今晚天气不好的话评论一通。
47
+
48
+ “你本来就不该出来。”她说,站起来去拿壁炉台上的两个彩色茶叶罐。
49
+
50
+ 她原先坐在光线被遮住的地方,现在我把她的全身和面貌都看得清清楚楚。她苗条,显然还没有过青春期。挺好看的体态,还有一张我生平从未有幸见过的绝妙的小脸蛋。五官纤丽,非常漂亮。淡黄色的卷发,或者不如说是金黄色的,松松地垂在她那细嫩的颈上。至于眼睛,要是眼神能显得和悦些,就要使人无法抗拒了。对我这容易动情的心说来倒是常事,因为它们所表现的只是在轻蔑与近似绝望之间的一种情绪,而在那张脸上看见那样的眼神是特别不自然的。
51
+
52
+ 她简直够不到茶叶罐。我动了一动,想帮她一下。她猛地扭转身向我,像守财奴看见别人打算帮他数他的金子一样。
53
+
54
+ “我不要你帮忙,”她怒气冲冲地说,“我自己拿得到。”
55
+
56
+ “对不起!”我连忙回答。
57
+
58
+ “是请你来吃茶的吗?”她问,把一条围裙系在她那干净的黑衣服上,就这样站着,拿一匙茶叶正要往茶壶里倒。
59
+
60
+ “我很想喝杯茶。”我回答。
61
+
62
+ “是请你来的吗?”她又问。
63
+
64
+ “没有,”我说,勉强笑一笑。“您正好请我喝茶。”
65
+
66
+  
67
+
68
+
69
+ 目录
70
+ 上一章
71
+ 下一章
72
+
73
+
74
+ 返回首页
radio_mlbee/gen_cmat.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Gen cmat for de/en text."""
2
+ # pylint: disable=invalid-name, too-many-branches
3
+
4
+ from typing import List, Optional
5
+
6
+ import more_itertools as mit
7
+ import numpy as np
8
+
9
+ # from model_pool import load_model_s
10
+ from hf_model_s_cpu import model_s
11
+ from logzero import logger
12
+ from tqdm import tqdm
13
+
14
+ from radio_mlbee.cos_matrix2 import cos_matrix2
15
+
16
+ try:
17
+ model = model_s()
18
+ except Exception as _:
19
+ logger.exception(_)
20
+ raise
21
+
22
+
23
+ def gen_cmat(text1: List[str], text2: List[str], bsize: int = 50) -> np.ndarray:
24
+ """Gen corr matrix for texts.
25
+
26
+ Args:
27
+ text1: typically '''...''' splitlines()
28
+ text2: typically '''...''' splitlines()
29
+ bsize: batch size, default 50
30
+ text1 = 'this is a test'
31
+ text2 = 'another test'
32
+ """
33
+ bsize = int(bsize)
34
+ if bsize <= 0:
35
+ bsize = 50
36
+
37
+ if isinstance(text1, str):
38
+ text1 = [text1]
39
+ if isinstance(text2, str):
40
+ text1 = [text2]
41
+
42
+ vec1 = []
43
+ vec2 = []
44
+ len1 = len(text1)
45
+ len2 = len(text2)
46
+ tot = len1 // bsize + bool(len1 % bsize)
47
+ tot += len2 // bsize + bool(len2 % bsize)
48
+ with tqdm(total=tot) as pbar:
49
+ for chunk in mit.chunked(text1, bsize):
50
+ try:
51
+ vec = model.encode(chunk)
52
+ except Exception as exc:
53
+ logger.error(exc)
54
+ raise
55
+ vec1.extend(vec)
56
+ pbar.update()
57
+ for chunk in mit.chunked(text2, bsize):
58
+ try:
59
+ vec = model.encode(chunk)
60
+ except Exception as exc:
61
+ logger.error(exc)
62
+ raise
63
+ vec2.extend(vec)
64
+ pbar.update()
65
+ try:
66
+ # note the order vec2, vec1
67
+ _ = cos_matrix2(np.array(vec2), np.array(vec1))
68
+ except Exception as exc:
69
+ logger.exception(exc)
70
+ raise
71
+
72
+ return _
radio_mlbee/loadtext.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Load file content to text.
2
+
3
+ Check encoding and load a file to text.
4
+
5
+ Win
6
+ Linux
7
+ apt install libmagic1
8
+
9
+ py -3.8 -m pip install python-magic-bin
10
+ py -3.8 -m pip install python-magic
11
+
12
+ import magic
13
+ magic.from_file("testdata/test.pdf")
14
+
15
+ original load_textrev
16
+ refer to load_paras.py
17
+ """
18
+ # pylint: disable=line-too-long, unused-variable, unused-import
19
+
20
+ from pathlib import Path
21
+ from typing import List, Optional, Union # noqa
22
+
23
+ import cchardet
24
+ import pytest
25
+ from logzero import logger
26
+
27
+ # from detect_file import detect_file
28
+
29
+
30
+ def loadtext(filepath: Union[Path, str] = "") -> str:
31
+ """Load file context to text.
32
+
33
+ Check encoding and load a file to text.
34
+ """
35
+ filepath = Path(filepath)
36
+ if not filepath.is_file():
37
+ logger.error(" file [%s] does not exist or is not a file.", filepath)
38
+ # return None
39
+ raise Exception(f" file [{filepath}] does not exist or is not a file.")
40
+
41
+ # encoding = detect_file(filepath)
42
+ encoding = cchardet.detect(filepath.read_bytes()).get("encoding", "utf8")
43
+
44
+ if encoding is None:
45
+ raise Exception("cchardet.detect says it's not a text file.")
46
+
47
+ # cchardet: 'GB18030', no need for errors="ignore"
48
+ try:
49
+ text = filepath.read_text(encoding=encoding, errors="ignore")
50
+ except Exception as exc:
51
+ logger.error(" Opening %s resulted in errors: %s", filepath, exc)
52
+ raise
53
+
54
+ return text
55
+
56
+
57
+ def text2paras(text: str) -> List[str]:
58
+ """Convert text to list/paras, remove blank lines."""
59
+ _ = text.splitlines()
60
+
61
+ return [elm.strip() for elm in _ if elm.strip()]
62
+
63
+
64
+ def loadparas(filepath: Path) -> List[str]:
65
+ """Load file as paras list."""
66
+ try:
67
+ _ = loadtext(filepath)
68
+ except Exception as exc:
69
+ logger.error(exc)
70
+ raise
71
+
72
+ try:
73
+ _ = text2paras(_)
74
+ except Exception as exc:
75
+ logger.error(exc)
76
+ raise
77
+
78
+ return _
79
+
80
+
81
+ @pytest.mark.xfail(reason="no file provided, trying to open ’.‘.")
82
+ def test1():
83
+ r"""Tests default file."""
84
+ text = loadtext()
85
+ # eq_(2283, len(text))
86
+ # eq_(2283, len(text))
87
+
88
+ # del text
89
+ if text:
90
+ assert len(text) == 86423
91
+
92
+
93
+ def testgb():
94
+ r"""Tests shuangyu_ku\txt-books\19部世界名著中英文对照版TXT."""
95
+ file = r"C:\dl\Dropbox\shuangyu_ku\txt-books\19部世界名著中英文对照版TXT" r"\爱丽丝漫游奇境记.txt"
96
+ text = loadtext(file)
97
+ if text:
98
+ # assert len(text) == 190913
99
+ assert len(text) >= 188760
100
+
101
+ text0 = "ALICE'S ADVENTURES IN WONDERLAND\n CHAPTER 01 Down the Rabbit-Hole\n CHAPTER 02 The Pool of Tears\n CHAPTER 03 A Caucus-Race and a Long Tale\n CHAPTER 04 The Rabbit Sends in a Little Bill\n CHAPTER 05 Advice from a Caterpillar\n CHAPTER 06 Pig and Pepper\n CHAPTER 07 A Mad Tea-Party\n CHAPTER 08 The Queen's Croquet-Ground\n CHAPTER 09 The Mock Turtle's Story \n CHAPTER 10 The Lobster Quadrille\n CHAPTER 11 Who Stole the Tarts?\n CHAPTER 12 Alice's Evidence\n\n\n 爱 丽 丝 漫 游 奇 境 记 \n\n 第01章 " # NOQA
102
+
103
+ if text:
104
+ assert text0 == text[:500]
105
+
106
+
107
+ def test_utf_16le():
108
+ r"""Test 'E:\\beta_final_version\\build\\test_files\\files_for_testing_import\\Folding_Beijing_12.txt'."""
109
+ # file = 'E:\\beta_final_version\\build\\test_files\\files_for_testing_import\\Folding_Beijing_12.txt' # NOQA
110
+ file = r"C:\dl\Dropbox\mat-dir\snippets-mat\pyqt\Sandbox\hp_beta-version_files\test_files\files_for_testing_import\Folding_Beijing_12.txt" # NOQA
111
+ file = r"C:\dl\Dropbox\mat-dir\pyqt\Sandbox\hp_beta-version_files\test_files\files_for_testing_import\Folding_Beijing_12.txt"
112
+
113
+ text = loadtext(file)
114
+ if text:
115
+ assert len(text) == 117871
116
+
117
+ # text0 = '\ufeffFolding Beijing\t北京折叠\n"by Hao Jingfang, translated by Ken Liu"\t郝景芳\n# 1.\t# 1\n"At ten of five in the m' # NOQA
118
+ text0 = r'Folding Beijing\t北京折叠\n"by Hao Jingfang, translated by Ken Liu"\t郝景芳\n# 1.\t# 1\n"At ten of five in the mo' # NOQA
119
+ text2 = 'Folding Beijing\t\xe5\x8c\x97\xe4\xba\xac\xe6\x8a\x98\xe5\x8f\xa0\r\n"by Hao Jingfang, translated by Ken Liu"\t\xe9\x83\x9d\xe6\x99\xaf\xe8\x8a\xb3\r\n# 1.\t# 1\r\n"At ten of five in the mo'
120
+
121
+ del text2
122
+
123
+ # if text: assert text0 == text[:100]
radio_mlbee/utils.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Prep utils and data."""
2
+ # pylint: disable=invalid-name
3
+ from pathlib import Path
4
+
5
+ from logzero import logger
6
+
7
+ data_dir = Path(__file__).with_name("data")
8
+ try:
9
+ text1 = Path(data_dir, "test-en.txt").read_text()
10
+ except Exception as exc:
11
+ logger.eror("rea text1 error: %s, setting to ''", exc)
12
+ text1 = ""
13
+ try:
14
+ text2 = Path(data_dir, "test-zh.txt").read_text()
15
+ except Exception as exc:
16
+ logger.eror("rea text2 error: %s, setting to ''", exc)
17
+ text2 = ""
requirements.txt ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ about-time==3.1.1; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
2
+ aiohttp==3.8.1; python_version >= "3.7"
3
+ aiosignal==1.2.0; python_version >= "3.7"
4
+ alive-progress==2.4.1; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
5
+ analytics-python==1.4.0; python_version >= "3.7"
6
+ anyio==3.6.1; python_full_version >= "3.6.2" and python_version >= "3.7"
7
+ aset2pairs==0.1.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
8
+ asgiref==3.5.2; python_version >= "3.7"
9
+ asttokens==2.0.5; python_full_version >= "3.8.3" and python_version < "4.0"
10
+ async-timeout==4.0.2; python_version >= "3.7"
11
+ attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
12
+ backoff==1.10.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
13
+ bcrypt==3.2.2; python_version >= "3.7"
14
+ cchardet==2.1.7
15
+ certifi==2022.5.18.1; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
16
+ cffi==1.15.0; python_version >= "3.7"
17
+ charset-normalizer==2.0.12; python_full_version >= "3.8.3" and python_version >= "3.7" and python_version < "4" and python_full_version < "4.0.0"
18
+ click==8.1.3; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
19
+ cmat2aset==0.1.0a7; python_full_version >= "3.8.3" and python_version < "4.0"
20
+ colorama==0.4.4; python_full_version >= "3.8.3" and sys_platform == "win32" and python_full_version < "4.0.0" and python_version < "4.0" and platform_system == "Windows" and python_version >= "3.7"
21
+ cryptography==37.0.2; python_version >= "3.7"
22
+ cycler==0.11.0; python_version >= "3.7"
23
+ environs==9.5.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.6"
24
+ executing==0.8.3; python_full_version >= "3.8.3" and python_version < "4.0"
25
+ fastapi==0.78.0; python_full_version >= "3.6.1" and python_version >= "3.7"
26
+ ffmpy==0.3.0; python_version >= "3.7"
27
+ filelock==3.7.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
28
+ fonttools==4.33.3; python_version >= "3.7"
29
+ frozenlist==1.3.0; python_version >= "3.7"
30
+ gradio==3.0.15; python_version >= "3.7"
31
+ grapheme==0.6.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
32
+ h11==0.13.0; python_version >= "3.7"
33
+ hf-model-s-cpu==0.1.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
34
+ huggingface-hub==0.5.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
35
+ icecream==2.1.2
36
+ idna==3.3; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
37
+ install==1.3.5; python_version >= "3.5"
38
+ jinja2==3.1.2; python_version >= "3.7"
39
+ joblib==1.1.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.8"
40
+ kiwisolver==1.4.2; python_version >= "3.7"
41
+ linkify-it-py==1.0.3; python_version >= "3.7"
42
+ logzero==1.7.0
43
+ markdown-it-py==2.1.0; python_version >= "3.7" and python_version < "4.0"
44
+ markupsafe==2.1.1; python_version >= "3.7"
45
+ marshmallow==3.16.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
46
+ matplotlib==3.5.2; python_version >= "3.7"
47
+ mdit-py-plugins==0.3.0; python_version >= "3.7" and python_version < "4.0"
48
+ mdurl==0.1.1; python_version >= "3.7"
49
+ monotonic==1.6; python_version >= "3.7"
50
+ more-itertools==8.13.0; python_version >= "3.5"
51
+ multidict==6.0.2; python_version >= "3.7"
52
+ nltk==3.7; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
53
+ numpy==1.22.4
54
+ orjson==3.7.2; python_version >= "3.7"
55
+ packaging==21.3; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
56
+ pandas==1.4.2; python_full_version >= "3.8.3" and python_version < "4.0" and python_version >= "3.8"
57
+ paramiko==2.11.0; python_version >= "3.7"
58
+ pillow==9.1.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
59
+ pycparser==2.21; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
60
+ pycryptodome==3.14.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
61
+ pydantic==1.9.1; python_full_version >= "3.6.1" and python_version >= "3.7"
62
+ pydub==0.25.1; python_version >= "3.7"
63
+ pygments==2.12.0; python_full_version >= "3.8.3" and python_version < "4.0" and python_version >= "3.6"
64
+ pynacl==1.5.0; python_version >= "3.7"
65
+ pyparsing==3.0.9; python_full_version >= "3.8.3" and python_version >= "3.7" and python_full_version < "4.0.0"
66
+ python-dateutil==2.8.2; python_full_version >= "3.8.3" and python_version >= "3.8" and python_version < "4.0"
67
+ python-dotenv==0.20.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.6"
68
+ python-multipart==0.0.5; python_version >= "3.7"
69
+ pytz==2022.1; python_full_version >= "3.8.3" and python_version < "4.0" and python_version >= "3.8"
70
+ pyyaml==6.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.6"
71
+ regex==2022.6.2; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
72
+ requests==2.28.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.8.3" and python_full_version < "4.0.0"
73
+ scikit-learn==1.1.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.8" and python_version < "4.0"
74
+ scipy==1.6.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.8"
75
+ sentence-transformers==2.2.0
76
+ sentencepiece==0.1.96; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
77
+ set-loglevel==0.1.2; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
78
+ setuptools-scm==6.4.2; python_version >= "3.7"
79
+ six==1.16.0; python_full_version >= "3.8.3" and python_version >= "3.8" and python_version < "4.0"
80
+ sklearn==0.0; python_full_version >= "3.8.3" and python_version < "4.0"
81
+ sniffio==1.2.0; python_full_version >= "3.6.2" and python_version >= "3.7"
82
+ starlette==0.19.1; python_full_version >= "3.6.1" and python_version >= "3.7"
83
+ threadpoolctl==3.1.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.8"
84
+ tokenizers==0.12.1; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
85
+ tomli==2.0.1; python_version >= "3.7"
86
+ torch @ https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp38-cp38-linux_x86_64.whl ; python_full_version >= "3.7.0" and python_version >= "3.7" or sys_platform == "linux" or sys_platform == "win32"
87
+ torchvision==0.12.0; python_version >= "3.7"
88
+ tqdm==4.64.0; python_full_version >= "3.8.3" and python_full_version < "4.0.0" and python_version >= "3.7"
89
+ transformers==4.19.4; python_full_version >= "3.8.3" and python_full_version < "4.0.0"
90
+ typer==0.4.1; python_version >= "3.6"
91
+ typing-extensions==4.2.0
92
+ uc-micro-py==1.0.1; python_version >= "3.7"
93
+ urllib3==1.26.9; python_full_version >= "3.8.3" and python_version < "4" and python_version >= "3.7" and python_full_version < "4.0.0"
94
+ uvicorn==0.17.6; python_version >= "3.7"
95
+ yarl==1.7.2; python_version >= "3.7"
run-nodemon-app.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # nodemon -w radio_mlbee -x python radio_mlbee/app.py
2
+ nodemon -w radio_mlbee -w app.py -x python app.py
tests/test_gen_cmat_aset2pairs.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Test gen_cmat, aset2pairs."""
2
+ from aset2pairs import aset2pairs
3
+ from cmat2aset import cmat2aset
4
+
5
+ from radio_mlbee.gen_cmat import gen_cmat
6
+ from radio_mlbee.loadtext import loadparas
7
+
8
+ paras1 = loadparas("radio_mlbee/data/sternstunden04-en.txt")
9
+ paras2 = loadparas("radio_mlbee/data/sternstunden04-de.txt")
10
+ cmat = gen_cmat(paras1, paras2)
11
+
12
+
13
+ def test_gen_cmat_sternstunden04():
14
+ """Test gen_cmat sternstunden04."""
15
+ len1, len2 = len(paras1), len(paras2)
16
+
17
+ # note the order
18
+ assert cmat.shape == (len2, len1)
19
+
20
+
21
+ def test_aset2pairs():
22
+ """Test aset2pairs."""
23
+ aset = cmat2aset(cmat)
24
+ pairs = aset2pairs(paras1, paras2, aset)
25
+
26
+ assert "Marseillaise" in pairs[2][0]
27
+ assert "Marseillaise" in pairs[2][1]
28
+ assert pairs[2][2] > 0.95
tests/test_model_s.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Test model_s."""
2
+ # pylint: disable=broad-except
3
+ from hf_model_s_cpu import model_s
4
+
5
+
6
+ def test_model_s():
7
+ """Test model_s."""
8
+ list1 = ["test", "测试", "love"]
9
+ list2 = ["this is a test"]
10
+ # cmat = gradio_cmat(list1, list2)
11
+
12
+ model = model_s()
13
+ vec1 = model.encode(list1)
14
+ vec2 = model.encode(list2)
15
+ cmat = vec1.dot(vec2.T)
16
+ assert cmat.shape == (3, 1)
17
+
18
+ assert cmat[0, 0] > 0.6
19
+ assert cmat[1, 0] > 0.6
20
+ assert cmat[2, 0] < 0.2
tests/test_radio_mlbee.py CHANGED
@@ -1,7 +1,6 @@
1
  """Test radio_mlbee."""
2
  # pylint: disable=broad-except
3
- from radio_mlbee import __version__
4
- from radio_mlbee import radio_mlbee
5
 
6
 
7
  def test_version():
 
1
  """Test radio_mlbee."""
2
  # pylint: disable=broad-except
3
+ from radio_mlbee import __version__, radio_mlbee
 
4
 
5
 
6
  def test_version():