Skip to main content

A package for identification of German--English code-switching

Project description

TongueSwitcher v2

TongueSwitcher was designed to be a code-switching identification system for German-English. It is mostly rule-based, using specially created wordlists for most of the heavy-lifting. It is therefore fast and efficient.

Identification is performed at the word and sub-word level, and then the identity of still unknown words is computed by the nearest identified tokens.

Usage

from tongueswitcher.executor import Executor

ts = Executor()

sentences = ["ich glaub ich muss echt rewatchen like i feel so empty was soll ich denn jetzt machen"]

results = ts.tongueswitcher_detect(sentences)

>>> [[{'lan': 'D', 'pos': 'PRON', 'token': 'ich'},
      {'lan': 'D', 'pos': 'VERB', 'token': 'glaub'},
      {'lan': 'D', 'pos': 'PRON', 'token': 'ich'},
      {'lan': 'D', 'pos': 'AUX', 'token': 'muss'},
      {'lan': 'D', 'pos': 'ADV', 'token': 'echt'},
      {'breakdown': 're+watch+en',
       'lan': 'M',
       'lans': 'E+E+D',
       'pos': 'VERB',
       'prefixes': {'lans': ['E'], 'text': ['re']},
       'roots': {'lans': ['E'], 'text': ['watch']},
       'suffixes': {'lans': ['D'], 'text': ['en']},
       'token': 'rewatchen'},
      {'lan': 'E', 'pos': 'SCONJ', 'token': 'like'},
      {'lan': 'E', 'pos': 'PRON', 'token': 'i'},
      {'lan': 'E', 'pos': 'VERB', 'token': 'feel'},
      {'lan': 'E', 'pos': 'ADV', 'token': 'so'},
      {'lan': 'E', 'pos': 'ADJ', 'token': 'empty'},
      {'lan': 'D.ILH', 'pos': 'ADV', 'token': 'was'},
      {'lan': 'D', 'pos': 'AUX', 'token': 'soll'},
      {'lan': 'D', 'pos': 'PRON', 'token': 'ich'},
      {'lan': 'D', 'pos': 'ADV', 'token': 'denn'},
      {'lan': 'D', 'pos': 'ADV', 'token': 'jetzt'},
      {'lan': 'D', 'pos': 'VERB', 'token': 'machen'}]]

Labels

TongueSwitcher v2 identifies words with the following acronyms:

E = English
D = German
M = Mixed
NE = Named Entity
O = Other

With possible subcategorizations:

.ILH = Interlingual homograph
.B = Borrowed word
.HT = Hashtag
.E  = Emoji
.P  = Punctuation

Dependencies

Other than the wordlists, we used Flair for POS tagging and a finetuned RoBERTa model for binary named entity recognition.

We used python version 3.7.

Citation

For more detail, please refer to our paper:

@inproceedings{sterner2023tongueswitcher,
  author    = {Igor Sterner and Simone Teufel},
  title     = {TongueSwitcher: Fine-Grained Identification of German-English Code-Switching},
  booktitle = {Sixth Workshop on Computational Approaches to Linguistic Code-Switching},
  publisher = {Empirical Methods in Natural Language Processing},
  year      = {2023},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tongueswitcher-1.0.7.tar.gz (18.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tongueswitcher-1.0.7-py3-none-any.whl (18.8 MB view details)

Uploaded Python 3

File details

Details for the file tongueswitcher-1.0.7.tar.gz.

File metadata

  • Download URL: tongueswitcher-1.0.7.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for tongueswitcher-1.0.7.tar.gz
Algorithm Hash digest
SHA256 db62256a77bd389dcefaa9f52da1b5a05fa0b532e25cfd3bbdeaecfb427e3c60
MD5 2e80553ee490d1ff5d72d6a78bb69e56
BLAKE2b-256 b1a70eaaa49588e3eab6bdbea0f7b76f72a2bd33ede8e8816f1933925ceef7cc

See more details on using hashes here.

File details

Details for the file tongueswitcher-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: tongueswitcher-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 18.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for tongueswitcher-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f05b29046e0e87afe0a91fde47112e974ed636a6013abbdcc3f9971b108504f4
MD5 12aa84c7fc27778a6db5c944ea8ace9c
BLAKE2b-256 306e6b68e6493df0edd6f6a94c808b9d3fa443fa4ad9d9073de989638804e2dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page