@korap/cmc-tagger 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## 1.1.0 - 2026-04-11
6
+
7
+ ### Added
8
+
9
+ - Hashtag tagging with the `HST` tag.
10
+ - The npm CLI is also exposed under the alias `cmc-tagger`.
11
+ - CLI version output via `-V` / `--version`.
12
+ - Regression tests for hashtag tagging and `ADR` tagging behavior.
13
+ - Expanded documentation covering the tagset, CoNLL-U output examples, limitations, performance, and application contexts.
14
+
15
+ ### Changed
16
+
17
+ - `ADR` is now emitted whenever a token matches the `@`-address pattern, regardless of existing POS values in the input.
18
+ - Purely numeric tokens such as `#10` are no longer tagged as `HST`; hashtags must contain at least one Unicode letter.
19
+ - Standalone `pkg` builds and release artifacts are now emitted as `cmc-tagger` / `cmc-tagger.exe` instead of `conllu2cmc`.
20
+ - Test tooling was updated by upgrading Jest from `^29.7.0` to `^30.3.0`; `.gitlab-ci-local` is now ignored during Jest module discovery to avoid local naming collisions.
21
+ - Documentation examples were revised and anonymized for public release.
22
+
23
+ ### Fixed
24
+
25
+ - Sparse mode now respects stdout backpressure, avoiding Node.js heap exhaustion on very large corpora with many matches.
26
+ - Hashtags containing Unicode letters such as umlauts are now tagged as `HST`.
27
+ - Emoji-name values in the `n` FEATS field no longer insert spurious underscores after separators such as `:` and `,`; examples now use forms like `thumbs_up:light_skin_tone` and `family:man,man,boy`.
28
+
29
+ ## 1.0.0
30
+
31
+ - Initial release.
package/Readme.md ADDED
@@ -0,0 +1,187 @@
1
+ # conllu-cmc
2
+
3
+ [![Docker](https://img.shields.io/docker/v/korap/conllu-cmc?label=Docker&sort=semver)](https://hub.docker.com/r/korap/conllu-cmc)
4
+
5
+ Reads CoNLL-U format from stdin and annotates Unicode emojis, ASCII emoticons, Wikipedia emoji templates, action words, hashtags, URLs, email addresses, and @names with CMC-oriented STTS-IBK tags in the XPOS column (Beißwenger/Bartsch/Evert/Würzner 2016). Writes CoNLL-U format to stdout.
6
+
7
+ For Unicode emojis (`EMOIMG`), the base emoji without skin tone modifiers
8
+ is written to the LEMMA column and Unicode emoji metadata is added to the FEATS column:
9
+
10
+ <!-- markdownlint-disable MD010 -->
11
+ ```tsv
12
+ # text = 😂
13
+ 1 😂 😂 _ EMOIMG g=smileys_&_emotion|s=face_smiling|q=fully_qualified|v=E0.6|n=face_with_tears_of_joy _ _ _ _
14
+ ```
15
+ <!-- markdownlint-enable MD010 -->
16
+
17
+ The FEATS field encodes: `g` (group), `s` (subgroup), `q` (qualification status), `v` (Unicode version first introduced), `n` (emoji name – including skin tone). In `n`, separators such as `:` and `,` are preserved without following spaces, e.g. `thumbs_up:light_skin_tone` or `family:man,man,boy`. See <https://www.unicode.org/Public/UCD/latest/emoji/emoji-test.txt> for details.
18
+
19
+ ## Tagset
20
+
21
+ All CMC annotations are written to the XPOS column (column 5 in CoNLL-U). For `EMOIMG`, the tagger also normalizes the LEMMA column to the base emoji and enriches FEATS with emoji metadata when available.
22
+
23
+ | Tag | Phenomenon | Example token | Output behavior |
24
+ | --- | --- | --- | --- |
25
+ | `EMOWIKI` | Wikipedia emoji templates | `[_EMOJI:{{S\|;)}}_]` | Writes `EMOWIKI` to XPOS |
26
+ | `EMOIMG` | Unicode emoji tokens | `😂`, `😇` | Writes `EMOIMG` to XPOS, normalizes LEMMA to the base emoji, and adds FEATS metadata |
27
+ | `AKW` | Action words / inflectives | `:grins:` | Writes `AKW` to XPOS |
28
+ | `EMOASC` | ASCII emoticons | `:)`, `<3` | Writes `EMOASC` to XPOS |
29
+ | `HST` | Hashtags | `#KorAP`, `#3D` | Writes `HST` to XPOS when the hashtag contains at least one letter |
30
+ | `URL` | URLs | `https://korap.ids-mannheim.de` | Writes `URL` to XPOS |
31
+ | `EML` | Email addresses | `mail@example.org` | Writes `EML` to XPOS |
32
+ | `ADR` | `@`-names / addresses | `@markup` | Writes `ADR` to XPOS |
33
+
34
+ Numeric-only forms such as `#10` are not tagged as `HST`.
35
+
36
+ ## CoNLL-U Output Examples
37
+
38
+ The following example shows how the different tags appear in CoNLL-U output. In all cases, the annotation is written to XPOS; only `EMOIMG` additionally changes LEMMA and FEATS.
39
+
40
+ <!-- markdownlint-disable MD010 -->
41
+ ```tsv
42
+ # foundry = cmc
43
+ # text_id = readme-demo
44
+ # text = [_EMOJI:{{cool}}_] 😂 :grins: :) #KorAP https://korap.ids-mannheim.de mail@example.org @handle <3
45
+ 1 [_EMOJI:{{cool}}_] _ _ EMOWIKI _ _ _ _ _
46
+ 2 😂 😂 _ EMOIMG g=smileys_&_emotion|s=face_smiling|q=fully_qualified|v=E0.6|n=face_with_tears_of_joy _ _ _ _
47
+ 3 :grins: _ _ AKW _ _ _ _ _
48
+ 4 :) _ _ EMOASC _ _ _ _ _
49
+ 5 #KorAP _ _ HST _ _ _ _ _
50
+ 6 https://korap.ids-mannheim.de _ _ URL _ _ _ _ _
51
+ 7 mail@example.org _ _ EML _ _ _ _ _
52
+ 8 @handle _ _ ADR _ _ _ _ _
53
+ 9 <3 _ _ EMOASC _ _ _ _ _
54
+ ```
55
+ <!-- markdownlint-enable MD010 -->
56
+
57
+ For compound emojis with modifiers or zero-width joiners, the tagger still writes `EMOIMG` and reduces LEMMA to the base emoji. For example, `✊🏿` is normalized to lemma `✊`, and `👨‍👨‍👦` is normalized to lemma `👨`.
58
+
59
+ ## Current Limitations
60
+
61
+ - The tagger is purely pattern-based. It does not consider sentential, pragmatic, or discourse context.
62
+ - The matching strategy is intentionally recall-oriented rather than precision-oriented. Ambiguous strings such as `<3` may therefore produce false positives.
63
+ - Annotation quality depends heavily on tokenization. Unicode emojis, grapheme clusters, zero-width joiners, modifiers, emoticons, and Wikipedia emoji templates should already be segmented into correct token units before tagging.
64
+ - We recommend [KorAP-Tokenizer](https://github.com/KorAP/KorAP-Tokenizer), which supports Unicode 17.0, including grapheme clusters, zero-width joiners, modifiers, emoticons, and Wikipedia-template-based emojis.
65
+
66
+ ## Local Usage
67
+
68
+ The npm package exposes the CLI under both `conllu-cmc` and `cmc-tagger`.
69
+
70
+ ### Using npm/node
71
+
72
+ ```shell
73
+ cat ./test/data/ndy.conllu | npx conllu-cmc
74
+
75
+ # Show version
76
+ npx conllu-cmc -V
77
+
78
+ # Alternative CLI name
79
+ npm exec --yes --package=. cmc-tagger -- -V
80
+ ```
81
+
82
+ ### Using standalone binary
83
+
84
+ ```shell
85
+ cat ./test/data/ndy.conllu | ./bin/linux/cmc-tagger
86
+
87
+ # Show version
88
+ ./bin/linux/cmc-tagger -V
89
+ ```
90
+
91
+ ### Generate KorAP-XML zip with CMC annotations
92
+
93
+ ```shell
94
+ korapxml2conllu kyc.zip | cmc-tagger -s | conllu2korapxml > kyc.cmc.zip
95
+ ```
96
+
97
+ ## Docker Usage
98
+
99
+ ```shell
100
+ # Annotate CoNLL-U input
101
+ cat ./test/data/ndy.conllu | docker run --rm -i korap/conllu-cmc
102
+
103
+ # With sparse output (only annotated lines)
104
+ cat ./test/data/ndy.conllu | docker run --rm -i korap/conllu-cmc -s
105
+
106
+ # Generate KorAP-XML zip with CMC annotations
107
+ # For korapxmltool see <https://github.com/KorAP/korapxmltool>
108
+ korapxmltool -A "docker run --rm -i korap/conllu-cmc -s" -t zip ndy.zip
109
+
110
+ # Show help
111
+ docker run --rm korap/conllu-cmc --help
112
+
113
+ # Show version
114
+ docker run --rm korap/conllu-cmc -V
115
+ ```
116
+
117
+ ## Performance
118
+
119
+ The tagger is implemented in Node.js because the runtime provides efficient regular-expression execution, which is central to this regex-based annotation workflow.
120
+
121
+ On CMC corpora with many matches, throughput is above 10 MB/s. This includes dense CMC material such as the NottDeuYTSch corpus.
122
+
123
+ ## Applications
124
+
125
+ The tagger is already used in corpus analysis scenarios with the corpus analysis platform [KorAP](https://github.com/KorAP/).
126
+
127
+ ### German Wikipedia Talk Pages
128
+
129
+ The German Wikipedia Talk Pages corpus is available at <https://korap.ids-mannheim.de/instance/wiki>. A query for an `EMOWIKI`, an `EMOASC`, and an `EMOIMG` sequence in one posting with up to 12 intervening tokens between each match is:
130
+
131
+ ```cqp
132
+ [cmc/p=EMOWIKI] []{0,12} [cmc/p=EMOASC] []{0,12} [cmc/p=EMOIMG]
133
+ ```
134
+
135
+ You can run this query directly here: <https://korap.ids-mannheim.de/instance/wiki?q=[cmc%2Fp%3DEMOWIKI]+[]{0%2C12}+[cmc%2Fp%3DEMOASC]+[]{0%2C12}+[cmc%2Fp%3DEMOIMG]>.
136
+
137
+ ### NottDeuYTSch
138
+
139
+ The NottDeuYTSch corpus (Cotgrove 2023) is accessible on request via <https://korap.ids-mannheim.de/instance/nottdeuytsch>.
140
+
141
+ ## Installation
142
+
143
+ ### Pre-built Binaries
144
+
145
+ Download pre-built executables from the [Releases](https://github.com/KorAP/KorAP-CoNLL-U-CMC/releases) page:
146
+
147
+ - `cmc-tagger` - Linux x64
148
+ - `cmc-tagger` - macOS x64
149
+ - `cmc-tagger.exe` - Windows x64
150
+
151
+ ### npm
152
+
153
+ ```shell
154
+ npm install 'git+https://gitlab.ids-mannheim.de/KorAP/conllu-cmc-docker.git'
155
+ ```
156
+
157
+ ### Build from source
158
+
159
+ ```shell
160
+ npm install
161
+ ```
162
+
163
+ #### Build standalone executables
164
+
165
+ ```shell
166
+ # Build for all platforms
167
+ npm run pkg-all
168
+
169
+ # Or build for specific platforms
170
+ npm run pkg-linux # Linux x64
171
+ npm run pkg-macos # macOS x64
172
+ npm run pkg-win # Windows x64
173
+ ```
174
+
175
+ Executables are created as `cmc-tagger` or `cmc-tagger.exe` in `bin/linux/`, `bin/macos/`, and `bin/win/`.
176
+
177
+ ### Docker
178
+
179
+ ```shell
180
+ docker pull korap/conllu-cmc
181
+ ```
182
+
183
+ ## References
184
+
185
+ - Beißwenger, Michael/Bartsch, Sabine/Evert, Stefan/Würzner, Kay-Michael (2016): EmpiriST 2015: A Shared Task on the Automatic Linguistic Annotation of Computer-Mediated Communication and Web Corpora. In: Proceedings of the 10th Web as Corpus Workshop. Berlin: Association for Computational Linguistics, S. 44–56. <https://doi.org/10.18653/v1/W16-2606>.
186
+ - Cotgrove, Louis (2023): New opportunities for researching digital youth language: The NottDeuYTSch corpus. In: Kupietz, Marc/Schmidt, Thomas (Hrsg.): Neue Entwicklungen in der Korpuslandschaft der Germanistik. Beiträge zur IDS-Methodenmesse 2022. (= Korpuslinguistik und interdisziplinäre Perspektiven auf Sprache (CLIP) 11). Tübingen: Narr, S. 102-115.
187
+ - Margaretha, Eliza/Lüngen, Harald/Diewald, Nils/Kupietz, Marc/Yaddehige, Rameela (2025): Building and querying Wikipedia discussion corpora using KorAP. In: Impulses and Approaches to Computer-Mediated Communication: Proceedings of the 12th International Conference on Computer Mediated Communication and Social Media Corpora for the Humanities (CMC 2025). Edited by Annamária Fábián/Igor Trost, S. 123-124.
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@korap/cmc-tagger",
3
+ "version": "1.1.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Reads CoNLL-U format from stdin and annotates emojis, emoticons, hashtags, URLs, email addresses, @addresses, and action words. Writes CoNLL-U format to stdout.",
8
+ "main": "src/index.js",
9
+ "files": [
10
+ "src/",
11
+ "Readme.md",
12
+ "CHANGELOG.md"
13
+ ],
14
+ "bin": {
15
+ "conllu-cmc": "src/index.js",
16
+ "cmc-tagger": "src/index.js"
17
+ },
18
+ "scripts": {
19
+ "pkg-linux": "rm -f bin/linux/conllu2cmc && pkg src/index.js --public -t node22-linux-x64 -o bin/linux/cmc-tagger && chmod +x bin/linux/cmc-tagger",
20
+ "pkg-macos": "rm -f bin/macos/conllu2cmc && pkg src/index.js --public -t node22-macos-x64 -o bin/macos/cmc-tagger",
21
+ "pkg-win": "rm -f bin/win/conllu2cmc.exe && pkg src/index.js --public -t node22-win-x64 -o bin/win/cmc-tagger.exe",
22
+ "pkg-all": "npm run pkg-linux && npm run pkg-macos && npm run pkg-win",
23
+ "pkg": "pkg",
24
+ "test": "jest",
25
+ "update-emoji-db": "node scripts/update_emoji_db.js",
26
+ "start": "node src/index.js"
27
+ },
28
+ "author": "Marc Kupietz",
29
+ "license": "BSD-2-Clause",
30
+ "dependencies": {
31
+ "command-line-args": "^5.2.1",
32
+ "command-line-usage": "^7.0.1",
33
+ "emoji-regex": "^10.3.0"
34
+ },
35
+ "pkg": {
36
+ "assets": [
37
+ "package.json"
38
+ ],
39
+ "scripts": [
40
+ "src/*.js"
41
+ ]
42
+ },
43
+ "jest": {
44
+ "modulePathIgnorePatterns": [
45
+ "/.gitlab-ci-local/"
46
+ ],
47
+ "testPathIgnorePatterns": [
48
+ "/node_modules/",
49
+ "/.gitlab-ci-local/"
50
+ ]
51
+ },
52
+ "devDependencies": {
53
+ "@yao-pkg/pkg": "^6.14.1",
54
+ "child_process": "^1.0.2",
55
+ "jest": "^30.3.0"
56
+ }
57
+ }