text2text


Nametext2text JSON
Version 1.8.3 PyPI version JSON
download
home_pagehttps://github.com/artitw/text2text
SummaryText2Text Language Modeling Toolkit
upload_time2024-10-29 01:24:13
maintainerNone
docs_urlNone
authorartitw
requires_pythonNone
licenseNone
keywords multilingual gpt chatgpt bert natural language processing nlp nlg text generation gpt question answer answering information retrieval tfidf tf-idf bm25 search index summary summarizer summarization tokenizer tokenization translation backtranslation data augmentation science machine learning colab embedding levenshtein sub-word edit distance conversational dialog chatbot llama rag
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Text2Text Language Modeling Toolkit

<details>
  <summary>Overview</summary>

* [Colab Notebooks](https://github.com/artitw/text2text#colab-notebooks)
* [Installation Requirements](https://github.com/artitw/text2text#installation-requirements)
* [Quick Start Guide](https://github.com/artitw/text2text#api-quick-start-guide)
* [Class Diagram](https://github.com/artitw/text2text#class-diagram)
* [Languages Available](https://github.com/artitw/text2text#languages-available)
* [Requirements & Installation](https://github.com/artitw/text2text#requirements-and-installation)
* [Examples](https://github.com/artitw/text2text#examples)
  * [Assistant](https://github.com/artitw/text2text#assistant)
  * [Tokenization](https://github.com/artitw/text2text#tokenization)
  * [Embedding](https://github.com/artitw/text2text#embedding--vectorization)
  * [TF-IDF](https://github.com/artitw/text2text#tf-idf)
  * [BM25](https://github.com/artitw/text2text#bm25)
  * [Index](https://github.com/artitw/text2text#index)
  * [Distance](https://github.com/artitw/text2text#levenshtein-sub-word-edit-distance)
  * [Translation](https://github.com/artitw/text2text#translation)
  * [Data Augmentation](https://github.com/artitw/text2text#data-augmentation--back-translation)
  * [Finetuning](https://github.com/artitw/text2text#training--finetuning)
  * [Identification](https://github.com/artitw/text2text#identification)
  * [Web Server](https://github.com/artitw/text2text#serving)
* [Questions?](https://github.com/artitw/text2text#questions)
* [Citation](https://github.com/artitw/text2text#citation)
* [Contributing](https://github.com/artitw/text2text#contributing)
* [Code of Conduct](https://github.com/artitw/text2text#code-of-conduct)

</details>

## Colab Notebooks
* Assistant (free private ChatGPT LLM alternative) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1K6Kk80w9vjFZ7PL9dPRgVuOPuaWcY4ae?usp=sharing)
* STF-IDF multilingual search [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1RaWj5SqWvyC2SsCTGg8IAVcl9G5hOB50?usp=sharing)
* All examples [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LE_ifTpOGO5QJCKNQYtZe6c_tjbwnulR)

## Installation Requirements
```
pip install -qq -U text2text
```
* [Examples](#examples) run with <16 GB RAM on free [Colab GPUs](https://colab.research.google.com/drive/1LE_ifTpOGO5QJCKNQYtZe6c_tjbwnulR).

## Quick Start Guide
Functionality | Invocation | Result
:------------: | :-------------: | :-------------:
Module Importing | `import text2text as t2t` | Libraries imported
[Assistant](https://github.com/artitw/text2text#assistant) | `t2t.Assistant().transform("Describe Text2Text in a few words: ")` | `['Text2Text is an AI-powered text generation tool that creates coherent and continuous text based on prompts.']`
[Language Model Setting](https://github.com/artitw/text2text#byot-bring-your-own-translator) | `t2t.Transformer.PRETRAINED_TRANSLATOR = "facebook/m2m100_418M"` | Change from default
[Tokenization](https://github.com/artitw/text2text#tokenization) | `t2t.Tokenizer().transform(["Hello, World!"])` | `[['▁Hello', ',', '▁World', '!']]`
[Embedding](https://github.com/artitw/text2text#embedding--vectorization) | `t2t.Vectorizer().transform(["Hello, World!"])` | `[[0.18745188, 0.05658336, ..., 0.6332584 , 0.43805206]]`
[TF-IDF](https://github.com/artitw/text2text#tf-idf) | `t2t.Tfidfer().transform(["Hello, World!"])` | `[{'!': 0.5, ',': 0.5, '▁Hello': 0.5, '▁World': 0.5}]`
[BM25](https://github.com/artitw/text2text#bm25) | `t2t.Bm25er().transform(["Hello, World!"])` | `[{'!': 0.3068528194400547, ',': 0.3068528194400547, '▁Hello': 0.3068528194400547, '▁World': 0.3068528194400547}]`
[Indexer](https://github.com/artitw/text2text#index) | `index = t2t.Indexer().transform(["Hello, World!"])` | Index object for information retrieval
[Translation](https://github.com/artitw/text2text#translation) | `t2t.Translater().transform(["Hello, World!"], src_lang="en, tgt_lang="zh")` | `['你好,世界!']`
[Data Augmentation](https://github.com/artitw/text2text#data-augmentation--back-translation) | `t2t.Variator().transform(["Hello, World!"], src_lang="en)` | `['Hello the world!', 'Welcome to the world.', 'Hello to the world!',...`
[Distance](https://github.com/artitw/text2text#levenshtein-sub-word-edit-distance) | `t2t.Measurer().transform(["Hello, World! [SEP] Hello, what?"])` | `[2]`
[Training/Finetuning](https://github.com/artitw/text2text#training--finetuning) | `t2t.Fitter().transform(["Hello, World! [TGT] Hello, what?"])` | Finetuned model saved
[Identification](https://github.com/artitw/text2text#identification) | `t2t.Identifier().transform(["Aj keď sa Buzz Aldrin stal až „druhým človekom“..."])` | `['sk', 'Slovak']`
[Web Server](https://github.com/artitw/text2text#serving) | `t2t.Serve(host='0.0.0.0', port=80)` | Web server started on host and port

## Examples

### Assistant
- Free private open source alternative to commercial LLMs.
- Commercial LLMs are costly, collect your data, impose quotas and rate limits that hinder development.
- Run at no cost on Google Colab free tier, so you don't even need your own device.

```
import text2text as t2t
asst = t2t.Assistant()

# Streaming example
chat_history = [
    {"role": "user",  "content": "Hi"},
    {"role": "assistant", "content": "Hello, how are you?"},
    {"role": "user", "content": "What should I do today?"}
]

result = asst.chat_completion(chat_history, stream=True) #{'role': 'assistant', 'content': '1. Make a list of things to be grateful for.\n2. Go outside and take a walk in nature.\n3. Practice mindfulness meditation.\n4. Connect with a loved one or friend.\n5. Do something kind for someone else.\n6. Engage in a creative activity like drawing or writing.\n7. Read an uplifting book or listen to motivational podcasts.'}
for chunk in result:
  print(chunk['message']['content'], end='', flush=True)

# Running conversation
messages = []
while True:
  user_input = input("User: ")
  print()
  messages.append({"role": "user", "content": user_input})
  print("Assistant: ")
  result = asst.chat_completion(messages, stream=False)
  print(result["message"]["content"])
  messages.append(result["message"])
  print()

# Schema for structured output
from pydantic import BaseModel

class Song(BaseModel):
    name: str
    artist: str

result = asst.chat_completion([
    {"role": "user",  "content": "What is Britney Spears's best song?"}
], schema=Song)
# Song(name='Toxic', artist='Britney Spears')

# Embeddings
asst.embed(["hello, world!", "this will be embedded"])
```

### Tokenization
```
t2t.Tokenizer().transform([
  "Let's go hiking tomorrow",
  "안녕하세요.",
  "돼지꿈을 꾸세요~~"
])

# Sub-word tokens
[['▁Let', "'", 's', '▁go', '▁hik', 'ing', '▁tom', 'orrow'],
 ['▁안녕', '하세요', '.'],
 ['▁', '돼', '지', '꿈', '을', '▁꾸', '세요', '~~']]
```

### Embedding / Vectorization
```
t2t.Vectorizer().transform([
  "Let's go hiking tomorrow",
  "안녕하세요.",
  "돼지꿈을 꾸세요~~"
])

# Embeddings
[[-0.00352954,  0.0260059 ,  0.00407429, ..., -0.04830331,
  -0.02540749, -0.00924972],
  [ 0.00043362,  0.00249816,  0.01755436, ...,  0.04451273,
    0.05118701,  0.01895813],
  [-0.03563676, -0.04856304,  0.00518898, ..., -0.00311068,
    0.00071953, -0.00216325]]
```

### TF-IDF
```
t2t.Tfidfer().transform([
  "Let's go hiking tomorrow",
  "안녕하세요.",
  "돼지꿈을 꾸세요~~"
])

# TF-IDF values
[{'!': 0.22360679774997894,
  "'": 0.44721359549995787,
  ',': 0.22360679774997894,
  'ing': 0.22360679774997894,
  'orrow': 0.22360679774997894,
  's': 0.44721359549995787,
  '▁Let': 0.22360679774997894,
  '▁go': 0.44721359549995787,
  '▁hik': 0.22360679774997894,
  '▁let': 0.22360679774997894,
  '▁tom': 0.22360679774997894},
 {'.': 0.5773502691896258,
  '▁안녕': 0.5773502691896258,
  '하세요': 0.5773502691896258},
 {'~~': 0.3535533905932738,
  '▁': 0.3535533905932738,
  '▁꾸': 0.3535533905932738,
  '꿈': 0.3535533905932738,
  '돼': 0.3535533905932738,
  '세요': 0.3535533905932738,
  '을': 0.3535533905932738,
  '지': 0.3535533905932738}]
```

### BM25
```
t2t.Bm25er().transform([
  "Let's go hiking tomorrow",
  "안녕하세요.",
  "돼지꿈을 꾸세요~~"
])

# BM25 values
[{"'": 1.2792257271403649,
  'ing': 1.2792257271403649,
  'orrow': 1.2792257271403649,
  's': 1.2792257271403649,
  '▁Let': 1.2792257271403649,
  '▁go': 1.2792257271403649,
  '▁hik': 1.2792257271403649,
  '▁tom': 1.2792257271403649},
 {'.': 1.751071282233123, '▁안녕': 1.751071282233123, '하세요': 1.751071282233123},
 {'~~': 1.2792257271403649,
  '▁': 1.2792257271403649,
  '▁꾸': 1.2792257271403649,
  '꿈': 1.2792257271403649,
  '돼': 1.2792257271403649,
  '세요': 1.2792257271403649,
  '을': 1.2792257271403649,
  '지': 1.2792257271403649}]
```

### Index
[![STF-IDF Demo](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1RaWj5SqWvyC2SsCTGg8IAVcl9G5hOB50?usp=sharing)
```
index = t2t.Indexer().transform([
  "Let's go hiking tomorrow, let's go!",
  "안녕하세요.",
  "돼지꿈을 꾸세요~~",
])

index.retrieve(["돼지"], k=1) #[['"돼지꿈을 꾸세요~~"']]

# Add documents
index.add(["Hello, World! 你好,世界!"])

# Remove by ids
index.remove([2]) #Removes "돼지꿈을 꾸세요~~"

# Retrieve k results per query sorted by distance
index.retrieve(["你好, World"], k=3)
```
To learn more, see [STF-IDF](https://arxiv.org/abs/2209.14281).

### Levenshtein Sub-word Edit Distance
```
t2t.Measurer().transform([
  "Hello, World! [SEP] Hello, what?",
  "안녕하세요. [SEP] 돼지꿈을 꾸세요~~"
], metric="levenshtein_distance")

# Distances
 [2, 8]
```

### Translation
```
# Sample texts
article_en = 'The Secretary-General of the United Nations says there is no military solution in Syria.'

notre_dame_str = "As at most other universities, Notre Dame's students run a number of news media outlets. The nine student - run outlets include three newspapers, both a radio and television station, and several magazines and journals. Begun as a one - page journal in September 1876, the Scholastic magazine is issued twice monthly and claims to be the oldest continuous collegiate publication in the United States. The other magazine, The Juggler, is released twice a year and focuses on student literature and artwork. The Dome yearbook is published annually. The newspapers have varying publication interests, with The Observer published daily and mainly reporting university and other news, and staffed by students from both Notre Dame and Saint Mary's College. Unlike Scholastic and The Dome, The Observer is an independent publication and does not have a faculty advisor or any editorial oversight from the University. In 1987, when some students believed that The Observer began to show a conservative bias, a liberal newspaper, Common Sense was published. Likewise, in 2003, when other students believed that the paper showed a liberal bias, the conservative paper Irish Rover went into production. Neither paper is published as often as The Observer; however, all three are distributed to all students. Finally, in Spring 2008 an undergraduate journal for political science research, Beyond Politics, made its debut."

bacteria_str = "Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats."

bio_str = "Biology is the science that studies life. What exactly is life? This may sound like a silly question with an obvious answer, but it is not easy to define life. For example, a branch of biology called virology studies viruses, which exhibit some of the characteristics of living entities but lack others. It turns out that although viruses can attack living organisms, cause diseases, and even reproduce, they do not meet the criteria that biologists use to define life."

t2t.Translator().transform([
  article_en,
  notre_dame_str,
  bacteria_str,
  bio_str
], src_lang='en', tgt_lang='zh')

# Translations
['联合国秘书长说,叙利亚没有军事解决方案。',
 '与大多数其他大学一样,Notre Dame的学生运行的新闻媒体渠道的数量。九个学生 - 运行的渠道包括三份报纸,两台广播电视台,以及几本杂志和杂志。 开始作为一个一页的杂志在1876年9月,该杂志的Schoolistic发行了每月两次,并声称是美国最古老的连续的大学新闻出版物,和其他杂志,TheJuggler,每年发行两次,并专注于学生文学和艺术作品。 多姆年刊每年发行。 报纸有不同的出版利益,与The Observer发表每日,主要报道大学和其他新闻,并由学生从Notre Dame和圣玛丽的学院。 与Scholastic和The Dome不同,The Observer是一个独立的公众作品,但没有教师顾',
 '细菌是生物细胞的一种类型. 它们构成一个大范围的亲生微生物. 通常几微米长,细菌有许多形状,从球到杖和螺旋。 细菌是地球上出现的第一个生命形式之一,并且存在于其大多数栖息地。',
 '生物学是研究生命的科学. 究竟什么是生命? 这可能听起来像一个愚蠢的问题,有一个显而易见的答案,但它并不容易定义生命. 例如,一个名为病毒学的生物学分支研究病毒,这些病毒表现出一些活体的特征,但缺乏其他。']
```

#### BYOT: Bring Your Own Translator
 * The default translator requires no more than 16GB of memory.
 * You can specify other pretrained translators at your own risk.
 * Make sure src_lang and tgt_lang codes conform to that model.

<details>
  <summary>BYOT examples</summary>

```
t2t.Transformer.PRETRAINED_TRANSLATOR = "facebook/mbart-large-50-many-to-many-mmt"
t2t.Transformer.LANGUAGES = {
  'af_ZA': 'Afrikaans',
  'ar_AR': 'Arabic',
  'az_AZ': 'Azerbaijani',
  'bn_IN': 'Bengali',
  'cs_CZ': 'Czech',
  'de_DE': 'German',
  'en_XX': 'English',
  'es_XX': 'Spanish',
  'et_EE': 'Estonian',
  'fa_IR': 'Persian',
  'fi_FI': 'Finnish',
  'fr_XX': 'French',
  'gl_ES': 'Galician',
  'gu_IN': 'Gujarati',
  'he_IL': 'Hebrew',
  'hi_IN': 'Hindi',
  'hr_HR': 'Croatian',
  'id_ID': 'Indonesian',
  'it_IT': 'Italian',
  'ja_XX': 'Japanese',
  'ka_GE': 'Georgian',
  'kk_KZ': 'Kazakh',
  'km_KH': 'Khmer',
  'ko_KR': 'Korean',
  'lt_LT': 'Lithuanian',
  'lv_LV': 'Latvian',
  'mk_MK': 'Macedonian',
  'ml_IN': 'Malayalam',
  'mn_MN': 'Mongolian',
  'mr_IN': 'Marathi',
  'my_MM': 'Burmese',
  'ne_NP': 'Nepali',
  'nl_XX': 'Dutch',
  'pl_PL': 'Polish',
  'ps_AF': 'Pashto',
  'pt_XX': 'Portuguese',
  'ro_RO': 'Romanian',
  'ru_RU': 'Russian',
  'si_LK': 'Sinhala',
  'sl_SI': 'Slovene',
  'sv_SE': 'Swedish',
  'sw_KE': 'Swahili',
  'ta_IN': 'Tamil',
  'te_IN': 'Telugu',
  'th_TH': 'Thai',
  'tl_XX': 'Tagalog',
  'tr_TR': 'Turkish',
  'uk_UA': 'Ukrainian',
  'ur_PK': 'Urdu',
  'vi_VN': 'Vietnamese',
  'xh_ZA': 'Xhosa',
  'zh_CN': 'Chinese'
}
t2t.Translator().transform(
  ["I would like to go hiking tomorrow."],
  src_lang="en_XX",
  tgt_lang='zh_CN'
)
['我想明天去徒步旅行。']
```

</details>

### Data Augmentation / Back-Translation
Back-translations useful for augmenting training data
```
t2t.Variator().transform([bacteria_str], src_lang='en')
```

<details>
  <summary>Show results</summary>

```
# Variations
['Bacteria are a kind of biological cell. They form a large domain of prokaryotic micro-organisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to borders and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles',
 'Bacteria are a type of biological cell, forming a large scale of procariotic microbials, usually a few micrometers in length, and have many shapes, ranging from bodies to roots and heads, and bacteria were among the first forms of life that appeared on Earth, and they are present in most of their environments.',
 'The bacteria are a type of biological cell. They constitute a great domain of procariotic microorganisms. Typically a few micrometres of length, the bacteria have a series of shapes, variing from spheres to rays and spirals.',
 'Bacteria are a type of biological cell. They form a large range of procaryotic microorganisms. Typically, at a length of several micrometers, bacteria have a lot of shapes, between spheres and spirals. Bacteria have been among the first forms of life on Earth, and are in most of its habitats.',
 'Bacteria type biological cell. They make up a large domain of procariotic microorganisms. typically several micrometers long, bacteria have a number of formats, from spheres to roses and spirals. bacteria were among the first life formats to appear on Earth, and are present in most of its habitats.',
 'Bacteria are types of biological cells. They make up a great home of procaryotical microorganisms. Usually with a few micrometers of length, bacteria have several shapes that are located from spheres to species and spirals. Bacteria were from the first forms of life that appeared on Earth, and are found in many of their animals.',
 'Bacteria are a type of biological cell. They make up a large range of procariotic microorganisms. Usually several micrometers in length, bacteria have a number of shapes ranging from spheres to stairs and spirals. Bacteria are among the first forms of life that appear on Earth, and are available in most of its habitats.',
 'Bacteria are a type of organic cell. They create a larger area of procreatic microorganisms. usually a few micrometers long, the bacteria have a number of sizes, the streets and spirals from the surfers. the bacteria were in the first life sizes appeared on Earth, and present in most of its reality.',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'The bacteria are a type of biological cell.They make a large domain of procarytic microorganisms.Typically a few micrometers long, the bacteria have a number of forms, from spheres to roots and spirals.The bacteria were among the first life forms that appear on Earth, and are present in most of their habitats.',
 'Bacteria are a type of biological cell. they constitute a great domain of prokarotic microorganisms. Typically a few micrometers of length, the bacteria have a series of shapes, which vary from spheres to wheels and spirals. The bacteria were among the first forms of life that appear on Earth, and are present in most of their habitats.',
 'The bacteria are a type of biological cell. The bacteria are a different domain of prokaryotic microorganisms. The bacteria are a form, from spheres to wraps and spirals. The bacteria is one of the first life forms of appearance on Earth, and is one of the habitats.',
 'Bacteria are a type of biological cells. they form a large area of prokaryotic microorganisms. Typically several micrometers in length, bacteria have several shapes, from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its residential spaces.',
 'Bacteria is a type of biological cell. It is fat in the fat in the prokaryotic microorganisms. The fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat.',
 'Bacteria are a type of biological cell. They form a large domain of prokaryotic microorganisms. Typically a couple of micrometers in length, bacteria have a variety of forms, ranging from spheres to layers and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They form a large range of prokaryotic microorganisms. Normally a few micrometers in length, bacteria have a number of forms, from spheres to roots and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of their habitats.',
 'Bacteria are a kind of organic cells. they make up a large range of prehyroid microorganisms. Usually a few micrometer length, bacteria have a number of forms, ranging from spheres to roots and spherals. The bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to roots and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. they constitute a great domain of procariotic microorganisms. Typically a few micrometers of length, bacteria have a series of shapes, which vary from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',
 'Bacteria are a type of biological cells. They form a large area of prokarotic microorganisms. usually a few micrometers long, bacteria have a number of forms that range from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',
 'Bacteria are a type of biological cells.They make up a large range of procaryotic microorganisms.The bacteria usually have a variety of shapes, ranging from branches to branches and spirals.The bacteria were among the first vital forms that appear on earth and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They form a large area of prokaryotic microorganisms. Typically a few micrometers length, bacteria have several forms, ranging from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitat environments.',
 'Bacteria are a type of biological cell. They constitute a large range of procaryotic microorganisms. Usually, a few micrometers long, the bacteria have a number of shapes, ranging from spheres to roots and spirals. The bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cells. They set up a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a variety of forms, ranging from spheres to rectum and spirals. Bacteria are among the first forms of life that come to the Earth, and are in the most of their habitats.',
 'Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria are a number of shapes, ranges from spheres to roads and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They constitute a great domain of procariotic microorganisms. Typically a few micrometers of length, the bacteria have a series of shapes, which vary from spheres to roots and spirals. The bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',
 'On the other hand, it is important to note that in the past few decades, there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country.',
 'Bacteria is a type of biological cell. It has a big domain and prokaryotic microorganisms. It has a micrometres at the time, bacteria has in a number of shapes, ranging from spheres to rods and spirals. Bacteria is in the first and life shapes to appear on Earth, and is in the best and best forms.',
 'Bacteria are a type of biological cells.They constitute a large area of procreatic microorganisms.Generally a few micrometers long, bacteria have a number of forms, formed from literature to waves and spirals.Bacteria were among the first forms of life to appear on Earth, and they exist in most aspects.',
 'Bacteria are a type of organic cells. They create a large range of procariotic microorganisms. Usually in a few micrometers length, bacteria have many shapes, ranging from spare to wire and wire. Bacteria were one of the first forms of life that appeared on Earth, and are present in most of their population.',
 'Bacteria are a type of biological cell. they make a large domain of procarytic microorganisms. usually a few micrometers in length, bacteria have a number of forms, from spheres to roots and spirals. bacteria were among the first forms of life that appear on Earth, and are present in most of their habitats.',
 'Bacteria are a kind of biological cell. It represents a large domain of pro-cariotic microorganisms. Typically in some micrometres of length, bacteria have a lot of training, from the spheres of their hands and spirals. Bacteria were one of the first training of life appearing in the world, and are present in the majority of their habitats.',
 'Bacteria are a kind of biological cell. These form a large range of procarytic microorganisms. Generally, some micrometer long bacteria are in a variety of shapes, from spheres to fiber and spirals. Bacteria were among the first forms of life to appear on Earth and are present in most of their habitats.',
 "Related Topics: Faith  Faith as a Function of Prayer  Faith as Gift of God  Faith, Living  Fasting  Loyalty  Prayer  Prayer as Contact with God  Prayer as Conversation  Prayer as Fellowship  Prayer's Purpose  Prayer, Effectiveness in  Prayer, Power of  Praying Always  Praying at All Times  Praying without Ceasing  Relationship with God  Trust  Unbelief  Weak Prayer Life",
 'Bacteria are a type of biological cell. they form a large domain of prokaryotic microorganisms. usually a few micrometers long, bacteria have several shapes, from spheres to roots and spirals. Bacteria are among the first forms of life that appear on Earth, and present in most of its habitats.',
 'Bacteria is a type of biological cell. It provides a big domain of prokaryotic microorganisms. It provides some micrometres to spread, bacteria has many types, such as spheres and rods and spirals. Bacteria is the primary high-type species to be found on Earth, and is covered by many of its habitats.',
 'The bacteria is a type of biological cell. The bacteria is a type of bacteria that can be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found.',
 'Bacteria are a type of biological cells. They are a large area of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of species, ranging from areas to wounds and spirals. Bacteria were among the first biological phenomena to appear on the earth, and are located in the most biological phenomena.',
 'Bacteria are a type of biological cell. they constitute a wide domain of procariotic microorganisms. usually a few micrometers of length, bacteria have a number of shapes, ranging from spheres to roots and spirals. bacteria are among the first forms of life that appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biocells They make up a wide range of procariotic microorganisms, usually in a number of micrometres of length, bacteria have a variety of shapes from spheres to wings and spirals Bacteria are one of the first forms of life that appear on Earth and are present in most of their habitat.',
 'Bacteria is a type of biological cell.It is a large domain of prokaryotic microorganisms.Al a few micrometers in length, bacteria have a number of shapes, spread from spheres to grass and spiral.Bacteria are among the first forms of life to be displayed on Earth, and are present in most habitats.',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. (cancer, transport, transport, transport, transport)',
 'The bacteria have biological cells. They are spread by procariotic microorganisms. The substance has several micrometers, the bacteria have many forms, spheres and spirals.',
 'Tag is a type of tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag',
 'It is true that there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world.',
 'Bacteria are a type of biological cells.They make up a large range of procariotic microorganisms.In general, a few meters long, the bacteria have several forms from spheres to roots and spheres.The bacteria were one of the first forms of life to appear on Earth, and exist in most ecosystems.',
 'Bacteria are a type of biological cell. They form a large domain of prokaryotic microorganisms. Typically a few micrometers of length, bacteria have a number of forms, from spheres to spheres and spirals. Bacteria were between the first forms of life and appeared on Earth, and are in the majority of habitats.',
 'Bacteria is a type of biological cell. They are in a big domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria has a number of shapes, ranging from spheres to roads and spirals. Bacteria was among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot.',
 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Types of micrometers in the latter, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first forms of life to appear on Earth, and are renowned in more than its kind.',
 'Bacteria are a type of biological cells. They make up a large area of procarytic microorganisms. Usually a few micrometers long, bacteria have several forms ranging from spheres to branches and spirals. Bacteria were among the first forms of life that appeared on Earth, and are in many of its habitats.',
 'Bacteria are a type of biological cells. they form a large range of prokaryotic microorganisms. usually a few micrometers long, bacteria have several shapes, from spheres to roots and spirals. bacteria were among the first forms of life that appeared on Earth, and are located in the majority of its habitat.',
 'The bacteria is a type of biological cell. It creates a large scale of prokaryotic microorganisms. Usually small, the bacteria have a variety of forms, to spheres and spirals. The bacteria is one of the first forms of life found in the earth, and is present in most of its habitats.',
 'Bacteria are a type of biological cells. they represent a large area of procariotic microorganisms. Usually several micrometers in length, bacteria have a large number of shapes, ranging from spheres to genes and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',
 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth.',
 'Bacteria are a biological pattern. They are a multi-facet of procariotic microorganisms. Moreover, with a micrometer, there are different types of bacteria shapes and spirals. The bacteria was one of the first life patterns in the world and it has a large pattern.',
 'Bacteria are types of biological cells. They become a large domain of procariotic microbes. Usually some micrometers are long, there are many shapes of bacteria, from spera to spira and spila. Bacteria were the first life shapes to appear on Earth, and are present in most of them.',
 'Bacteria are a kind of biological cell.They form a large domain of prokaryotic microorganisms.Overall a few micrometers in length, bacteria have several shapes, from spheres to roots and spirals.Bacteria are among the first forms of life that appear on Earth, and present in most of its habitats.',
 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life shapes to appear on Earth, and are present in most of its habitats. The bacteria kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind',
 '“That’s what I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do, I’m going to do.”',
 'Bacteria are a kind of biological cell. They form a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rocks and spirals. Bacteria were among the first forms of life that appear on Earth, and are present in most of the habitats.',
 'Bacteria are a type of biological cell. They form a large area of prokaryotic microorganisms. Usually a few micrometers in length, bacteria have a variety of forms, from spheres to rows and spirals. Bacteria were among the first life forms that appeared on Earth, and are present in most of its habitats.',
 'small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small',
 'Bacteria are a type of biological cell, they constitute a large range of procariotic microorganisms, typically micrometers long, bacteria are a variety of shapes, from spheres to wheels and spirals, and bacteria are among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to roads and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria is a kind of bacteria. They have a large area of prokaryotic microorganisms. Usually some micrometers are a kind of bacteria, from fresh to color and from fresh. Bacteria as first bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria.',
 'Bacteria are a type of biological cells. they make up a large area of prokaryotic microorganisms. usually a few micrometers long, bacteria have a number of shapes, from spheres to corners and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell. They form a large range of procariotic microorganisms. In the usual length of several micrometers, bacteria have many shapes, from shapes to colors and spirals. Bacteria are in the first life shapes that appear on earth, and are present in many beauty.',
 'Bacteria are a type of biological cell. they constitute a great domain of procarotic microorganisms. typically, some micrometers of length, the bacteria have a number of shapes, ranging from spheres to roots and spirals. the bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',
 'Bacteria are a type of biological cell. they constitute a large range of procariotic microorganisms. usually, at a few micrometers of length, bacteria have a number of forms, from spheres to rows and spirals. bacteria have been among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cells. They make up a large domain of procariotic microorganisms. As a rule, several micrometers in length, bacteria have a number of forms, from spheres to births and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their fields.',
 'Bacteria is a section of biological negative. These are a large section of procariotic microorganisms. Generally, in the length of several micrometers, bacteria are in different forms, in sperm and sperm. Bacteria were in the earlier life forms of appearance on earth, and most of them are in life.',
 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cells. they form a large area of prokaryotic microorganisms. Typically several micrometers in length, bacteria have several shapes, ranging from spheres to tribes and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its living places.',
 'Bacteria are a type of biological cell. they make up a large area of procarotic microorganisms. Usually a few micrometres of length, bacteria have a number of forms, from the sphere to the wings and spirals. Bacteria were among the first life forms that occur on Earth, and are present in most of their habitats.',
 'Bakteer is from mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid',
 'Bacteria are a type of biological cells.They make up a large range of prokaryotic microorganisms.Typically some micrometers in length, bacteria have a number of forms, dispersing from the sphere to the root and spirals.Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',
 'Bacteria are a type of biological cell.They make up a large domain of procariotic microorganisms.Generally a few micrometers in length, bacteria have a range of shapes, ranging from spheres to genes and spirals.Bacteria were among the first forms of life that appear on Earth, and are present in most of its habitats.',
 'Bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria',
 'Bacteria are a type of biological cell. They have a large domain of prokaryotic microorganisms. Usually a few micrometers long, bacteria have a number of shapes, spreading from spheres to roots and spirals. Bacteria are among the first forms of life that appear on Earth, and are in most habitats.',
 'Bacteria are a type of biological cell. They make up a large area of prokaryotic microorganisms. Usually a few micrometers in length, bacteria have a number of forms, ranging from spheres to rows and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',
 'Bacteria are a kind of biological cell. They make a large area of prokaryotic microorganisms. Usually several micrometres of time, bacteria have several varieties, from spheres to color and spirals. Bacteria were among the first kinds of life to appear on the earth, and are present in many parts of its environment.',
 'This is the first time I’ve been able to do it, and I’ve been able to do it, I’ve been able to do it, I’ve been able to do it, I’ve been able to do it, I’ve been able to do it.',
 'Bacteria are a type of biological cells. They generate a large area of prokaryotic microorganisms. Normally, several micrometers, the bacteria have multiple shapes from round to round and round. The bacteria is one of the first forms of life that appears on the earth and is found in most of its environment.',
 'The bacteria are a type of biological cell. These are a large domain of prokaryotic microorganisms. Typically in some micrometres of length, the bacteria have a number of shapes, from spheres to wraps and spirals. The bacteria are one of the first forms of life emerging on Earth, and are available in more habitats.',
 'Go and go and go and go and go and go and go and go.',
 'Bacteria are a biological type of cell. They form a large range of procaryotic microorganisms. typically in a few micrometers length, bacteria have a series of shapes, from spheres to roots and spirals. Bacteria have been among the first forms of life that appear on Earth and are present in most of their living areas.',
 'Bacteria are a type of biological cells. they form a large sphere of procariotic microorganisms. As a rule, a few micrometers of length, bacteria have a number of forms that vary from spheres to cows and spirals. Bacteria were among the first forms of life that appear on Earth, and present in most of its vital objects.',
 'Bacteria are a section of biological cells, they build a large place of procaryotic microorganisms, generally in a range of several micrometers, there are a large number of bacteria shapes, from spiders to wrinkles and spirals, bacteria were one of the first forms of life that appeared on earth, and are present in most populations.',
 'Bacteria are biological cells. They accumulate prokaryotic microorganisms. In a typical micrometer length, bacteria accumulate from sphera to sphera to sphera. Bacteria were one of the first forms of life on Earth, and are present in most biologies.',
 'Bacteria are a type of biological cell. They form a large range of prokaryotic microorganisms. Usually, a few micrometres in length, bacteria have a number of shapes, from crystals to roots and crystals. bacteria are one of the first forms of life appearing on Earth, and present in most of its organisms.',
 'Bacteria is a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria was among the first life forms to appear on Earth, and are present in most of its habitats. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',
 'The bacteria is a type of biological cell. The bacteria are prokaryotic microorganisms. According to many micrometres, the bacteria are many forms, from spheres to roads and spirals. The bacteria are the first life forms to appear on Earth, with many habitats.',
 'Bacteria is a type of biological cell. They represent a large area of prokaryotic microorganisms. Types of a little micrometer in the acteria, bacteria have a number of forms, refer to spheres and spirals. Bacteria are among the first life forms to appear on Earth, and are present in most of the bacteria.',
 'Bakteries are a type of biological cell. They were the best of prokaryotic microorganisms. They were one of the many micrometres, the bacteria are a lot of processes, from processes and processes. Bakteries are one of the processes of processes that are processed on Earth, and they are processed in all processes.',
 'Bacteria are a type of biocells, they make up a large area of probiotic microorganisms, usually several meters long bacteria have several shapes, from branches to roots and spirals, bacteria are one of the first forms of life that appear on Earth and are present in most of their habitats.',
 'The bacteria is a type of biological cells. The bacteria is a large area of prokaryotic microorganisms. The bacteria is a long micrometres, the bacteria is a spheres in roads and spirals. The bacteria is among the data, data, data, data and data.']
```

</details>

### Training / Finetuning
Finetune cross-lingual model on your data
```
result = t2t.Fitter().transform(["Hello, World! [TGT] 你好,世界!"],
  src_lang="en",
  tgt_lang="zh",
  num_epochs=10,
  save_directory="model_dir"
)

# load and use model from saved directory
t2t.Transformer.PRETRAINED_TRANSLATOR = "model_dir"
t2t.Translator().transform("Hello, World!", src_lang="en", tgt_lang="zh")
```

### Identification
Identify the language of a text. Not yet accurate for short sequences (<10 tokens)
```
t2t.Identifier().transform(["Aj keď sa Buzz Aldrin stal až „druhým človekom“, ktorý otlačil svoju nohu do povrchu Mesiaca...",])

# Prediction
`['sk', 'Slovak']`
```

### Serving
We aim to serve all functionality above
```
# Start web server
t2t.Server(host='0.0.0.0', port=80)

# Make POST requests
import socket
import requests

address = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
url = f"http://{address}"
transformer = "Translator"
payload = {
  "input_lines": ["hello", "world"],
  "src_lang": "en",
  "tgt_lang": "ko",
}
r = requests.post(f"{url}/{transformer}", json=payload)
print(r.json()) #{'result': ['안녕하세요', '세계']}

# Indexer actions
r = requests.post(f"{url}/Indexer/add", json=payload)
r = requests.post(f"{url}/Indexer/size")
r = requests.post(f"{url}/Indexer/search", json=payload)
r = requests.post(f"{url}/Indexer/retrieve", json=payload)
payload["ids"] = [0,1]
r = requests.post(f"{url}/Indexer/remove", json=payload)
```

## Questions?
For questions or help using Text2Text, please submit a [GitHub issue](https://github.com/artitw/text2text/issues).

## Citation
To cite this work, use the following BibTeX citations.
```
@article{stfidf,
  doi = {10.48550/ARXIV.2209.14281},
  url = {https://arxiv.org/abs/2209.14281},
  author = {Wangperawong, Artit},
  title = {Multilingual Search with Subword TF-IDF},
  publisher = {arXiv},
  year = {2022},
}
```
```
@misc{text2text@2020,
  author={Wangperawong, Artit},
  title={Text2Text Language Modeling Toolkit},
  year={2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/artitw/text2text}},
  url = {https://github.com/artitw/text2text}
}
```

## Contributing
There are many ways you can [contribute](https://github.com/artitw/text2text/blob/master/CONTRIBUTING.md):
1. Ask or answer a question in [Issues](https://github.com/artitw/text2text/issues)
2. Share your experiences on using Text2Text
3. Report bugs with information to reproduce
4. Request for new features or functionality
5. Improve code by submitting a [pull request](https://github.com/artitw/text2text/pulls) with outputs demonstrating the change
6. See [projects](https://github.com/artitw/text2text/projects), comment on a task issue to get involved

## Code of Conduct
Please adhere to our [code of conduct](https://github.com/artitw/text2text/blob/master/CODE_OF_CONDUCT.md) when participating in this project.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/artitw/text2text",
    "name": "text2text",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "multilingual gpt chatgpt bert natural language processing nlp nlg text generation gpt question answer answering information retrieval tfidf tf-idf bm25 search index summary summarizer summarization tokenizer tokenization translation backtranslation data augmentation science machine learning colab embedding levenshtein sub-word edit distance conversational dialog chatbot llama rag",
    "author": "artitw",
    "author_email": "artitw@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/42/7c/201301e42eab33921f883fd6c2fa5d572ef7b398d0482920c9d327188d12/text2text-1.8.3.tar.gz",
    "platform": null,
    "description": "# Text2Text Language Modeling Toolkit\n\n<details>\n  <summary>Overview</summary>\n\n* [Colab Notebooks](https://github.com/artitw/text2text#colab-notebooks)\n* [Installation Requirements](https://github.com/artitw/text2text#installation-requirements)\n* [Quick Start Guide](https://github.com/artitw/text2text#api-quick-start-guide)\n* [Class Diagram](https://github.com/artitw/text2text#class-diagram)\n* [Languages Available](https://github.com/artitw/text2text#languages-available)\n* [Requirements & Installation](https://github.com/artitw/text2text#requirements-and-installation)\n* [Examples](https://github.com/artitw/text2text#examples)\n  * [Assistant](https://github.com/artitw/text2text#assistant)\n  * [Tokenization](https://github.com/artitw/text2text#tokenization)\n  * [Embedding](https://github.com/artitw/text2text#embedding--vectorization)\n  * [TF-IDF](https://github.com/artitw/text2text#tf-idf)\n  * [BM25](https://github.com/artitw/text2text#bm25)\n  * [Index](https://github.com/artitw/text2text#index)\n  * [Distance](https://github.com/artitw/text2text#levenshtein-sub-word-edit-distance)\n  * [Translation](https://github.com/artitw/text2text#translation)\n  * [Data Augmentation](https://github.com/artitw/text2text#data-augmentation--back-translation)\n  * [Finetuning](https://github.com/artitw/text2text#training--finetuning)\n  * [Identification](https://github.com/artitw/text2text#identification)\n  * [Web Server](https://github.com/artitw/text2text#serving)\n* [Questions?](https://github.com/artitw/text2text#questions)\n* [Citation](https://github.com/artitw/text2text#citation)\n* [Contributing](https://github.com/artitw/text2text#contributing)\n* [Code of Conduct](https://github.com/artitw/text2text#code-of-conduct)\n\n</details>\n\n## Colab Notebooks\n* Assistant (free private ChatGPT LLM alternative) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1K6Kk80w9vjFZ7PL9dPRgVuOPuaWcY4ae?usp=sharing)\n* STF-IDF multilingual search [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1RaWj5SqWvyC2SsCTGg8IAVcl9G5hOB50?usp=sharing)\n* All examples [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1LE_ifTpOGO5QJCKNQYtZe6c_tjbwnulR)\n\n## Installation Requirements\n```\npip install -qq -U text2text\n```\n* [Examples](#examples) run with <16 GB RAM on free [Colab GPUs](https://colab.research.google.com/drive/1LE_ifTpOGO5QJCKNQYtZe6c_tjbwnulR).\n\n## Quick Start Guide\nFunctionality | Invocation | Result\n:------------: | :-------------: | :-------------:\nModule Importing | `import text2text as t2t` | Libraries imported\n[Assistant](https://github.com/artitw/text2text#assistant) | `t2t.Assistant().transform(\"Describe Text2Text in a few words: \")` | `['Text2Text is an AI-powered text generation tool that creates coherent and continuous text based on prompts.']`\n[Language Model Setting](https://github.com/artitw/text2text#byot-bring-your-own-translator) | `t2t.Transformer.PRETRAINED_TRANSLATOR = \"facebook/m2m100_418M\"` | Change from default\n[Tokenization](https://github.com/artitw/text2text#tokenization) | `t2t.Tokenizer().transform([\"Hello, World!\"])` | `[['\u2581Hello', ',', '\u2581World', '!']]`\n[Embedding](https://github.com/artitw/text2text#embedding--vectorization) | `t2t.Vectorizer().transform([\"Hello, World!\"])` | `[[0.18745188, 0.05658336, ..., 0.6332584 , 0.43805206]]`\n[TF-IDF](https://github.com/artitw/text2text#tf-idf) | `t2t.Tfidfer().transform([\"Hello, World!\"])` | `[{'!': 0.5, ',': 0.5, '\u2581Hello': 0.5, '\u2581World': 0.5}]`\n[BM25](https://github.com/artitw/text2text#bm25) | `t2t.Bm25er().transform([\"Hello, World!\"])` | `[{'!': 0.3068528194400547, ',': 0.3068528194400547, '\u2581Hello': 0.3068528194400547, '\u2581World': 0.3068528194400547}]`\n[Indexer](https://github.com/artitw/text2text#index) | `index = t2t.Indexer().transform([\"Hello, World!\"])` | Index object for information retrieval\n[Translation](https://github.com/artitw/text2text#translation) | `t2t.Translater().transform([\"Hello, World!\"], src_lang=\"en, tgt_lang=\"zh\")` | `['\u4f60\u597d,\u4e16\u754c!']`\n[Data Augmentation](https://github.com/artitw/text2text#data-augmentation--back-translation) | `t2t.Variator().transform([\"Hello, World!\"], src_lang=\"en)` | `['Hello the world!', 'Welcome to the world.', 'Hello to the world!',...`\n[Distance](https://github.com/artitw/text2text#levenshtein-sub-word-edit-distance) | `t2t.Measurer().transform([\"Hello, World! [SEP] Hello, what?\"])` | `[2]`\n[Training/Finetuning](https://github.com/artitw/text2text#training--finetuning) | `t2t.Fitter().transform([\"Hello, World! [TGT] Hello, what?\"])` | Finetuned model saved\n[Identification](https://github.com/artitw/text2text#identification) | `t2t.Identifier().transform([\"Aj ke\u010f sa Buzz Aldrin stal a\u017e \u201edruh\u00fdm \u010dlovekom\u201c...\"])` | `['sk', 'Slovak']`\n[Web Server](https://github.com/artitw/text2text#serving) | `t2t.Serve(host='0.0.0.0', port=80)` | Web server started on host and port\n\n## Examples\n\n### Assistant\n- Free private open source alternative to commercial LLMs.\n- Commercial LLMs are costly, collect your data, impose quotas and rate limits that hinder development.\n- Run at no cost on Google Colab free tier, so you don't even need your own device.\n\n```\nimport text2text as t2t\nasst = t2t.Assistant()\n\n# Streaming example\nchat_history = [\n    {\"role\": \"user\",  \"content\": \"Hi\"},\n    {\"role\": \"assistant\", \"content\": \"Hello, how are you?\"},\n    {\"role\": \"user\", \"content\": \"What should I do today?\"}\n]\n\nresult = asst.chat_completion(chat_history, stream=True) #{'role': 'assistant', 'content': '1. Make a list of things to be grateful for.\\n2. Go outside and take a walk in nature.\\n3. Practice mindfulness meditation.\\n4. Connect with a loved one or friend.\\n5. Do something kind for someone else.\\n6. Engage in a creative activity like drawing or writing.\\n7. Read an uplifting book or listen to motivational podcasts.'}\nfor chunk in result:\n  print(chunk['message']['content'], end='', flush=True)\n\n# Running conversation\nmessages = []\nwhile True:\n  user_input = input(\"User: \")\n  print()\n  messages.append({\"role\": \"user\", \"content\": user_input})\n  print(\"Assistant: \")\n  result = asst.chat_completion(messages, stream=False)\n  print(result[\"message\"][\"content\"])\n  messages.append(result[\"message\"])\n  print()\n\n# Schema for structured output\nfrom pydantic import BaseModel\n\nclass Song(BaseModel):\n    name: str\n    artist: str\n\nresult = asst.chat_completion([\n    {\"role\": \"user\",  \"content\": \"What is Britney Spears's best song?\"}\n], schema=Song)\n# Song(name='Toxic', artist='Britney Spears')\n\n# Embeddings\nasst.embed([\"hello, world!\", \"this will be embedded\"])\n```\n\n### Tokenization\n```\nt2t.Tokenizer().transform([\n  \"Let's go hiking tomorrow\",\n  \"\uc548\ub155\ud558\uc138\uc694.\",\n  \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n])\n\n# Sub-word tokens\n[['\u2581Let', \"'\", 's', '\u2581go', '\u2581hik', 'ing', '\u2581tom', 'orrow'],\n ['\u2581\uc548\ub155', '\ud558\uc138\uc694', '.'],\n ['\u2581', '\ub3fc', '\uc9c0', '\uafc8', '\uc744', '\u2581\uafb8', '\uc138\uc694', '~~']]\n```\n\n### Embedding / Vectorization\n```\nt2t.Vectorizer().transform([\n  \"Let's go hiking tomorrow\",\n  \"\uc548\ub155\ud558\uc138\uc694.\",\n  \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n])\n\n# Embeddings\n[[-0.00352954,  0.0260059 ,  0.00407429, ..., -0.04830331,\n  -0.02540749, -0.00924972],\n  [ 0.00043362,  0.00249816,  0.01755436, ...,  0.04451273,\n    0.05118701,  0.01895813],\n  [-0.03563676, -0.04856304,  0.00518898, ..., -0.00311068,\n    0.00071953, -0.00216325]]\n```\n\n### TF-IDF\n```\nt2t.Tfidfer().transform([\n  \"Let's go hiking tomorrow\",\n  \"\uc548\ub155\ud558\uc138\uc694.\",\n  \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n])\n\n# TF-IDF values\n[{'!': 0.22360679774997894,\n  \"'\": 0.44721359549995787,\n  ',': 0.22360679774997894,\n  'ing': 0.22360679774997894,\n  'orrow': 0.22360679774997894,\n  's': 0.44721359549995787,\n  '\u2581Let': 0.22360679774997894,\n  '\u2581go': 0.44721359549995787,\n  '\u2581hik': 0.22360679774997894,\n  '\u2581let': 0.22360679774997894,\n  '\u2581tom': 0.22360679774997894},\n {'.': 0.5773502691896258,\n  '\u2581\uc548\ub155': 0.5773502691896258,\n  '\ud558\uc138\uc694': 0.5773502691896258},\n {'~~': 0.3535533905932738,\n  '\u2581': 0.3535533905932738,\n  '\u2581\uafb8': 0.3535533905932738,\n  '\uafc8': 0.3535533905932738,\n  '\ub3fc': 0.3535533905932738,\n  '\uc138\uc694': 0.3535533905932738,\n  '\uc744': 0.3535533905932738,\n  '\uc9c0': 0.3535533905932738}]\n```\n\n### BM25\n```\nt2t.Bm25er().transform([\n  \"Let's go hiking tomorrow\",\n  \"\uc548\ub155\ud558\uc138\uc694.\",\n  \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n])\n\n# BM25 values\n[{\"'\": 1.2792257271403649,\n  'ing': 1.2792257271403649,\n  'orrow': 1.2792257271403649,\n  's': 1.2792257271403649,\n  '\u2581Let': 1.2792257271403649,\n  '\u2581go': 1.2792257271403649,\n  '\u2581hik': 1.2792257271403649,\n  '\u2581tom': 1.2792257271403649},\n {'.': 1.751071282233123, '\u2581\uc548\ub155': 1.751071282233123, '\ud558\uc138\uc694': 1.751071282233123},\n {'~~': 1.2792257271403649,\n  '\u2581': 1.2792257271403649,\n  '\u2581\uafb8': 1.2792257271403649,\n  '\uafc8': 1.2792257271403649,\n  '\ub3fc': 1.2792257271403649,\n  '\uc138\uc694': 1.2792257271403649,\n  '\uc744': 1.2792257271403649,\n  '\uc9c0': 1.2792257271403649}]\n```\n\n### Index\n[![STF-IDF Demo](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1RaWj5SqWvyC2SsCTGg8IAVcl9G5hOB50?usp=sharing)\n```\nindex = t2t.Indexer().transform([\n  \"Let's go hiking tomorrow, let's go!\",\n  \"\uc548\ub155\ud558\uc138\uc694.\",\n  \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\",\n])\n\nindex.retrieve([\"\ub3fc\uc9c0\"], k=1) #[['\"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"']]\n\n# Add documents\nindex.add([\"Hello, World! \u4f60\u597d,\u4e16\u754c!\"])\n\n# Remove by ids\nindex.remove([2]) #Removes \"\ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n\n# Retrieve k results per query sorted by distance\nindex.retrieve([\"\u4f60\u597d, World\"], k=3)\n```\nTo learn more, see [STF-IDF](https://arxiv.org/abs/2209.14281).\n\n### Levenshtein Sub-word Edit Distance\n```\nt2t.Measurer().transform([\n  \"Hello, World! [SEP] Hello, what?\",\n  \"\uc548\ub155\ud558\uc138\uc694. [SEP] \ub3fc\uc9c0\uafc8\uc744 \uafb8\uc138\uc694~~\"\n], metric=\"levenshtein_distance\")\n\n# Distances\n [2, 8]\n```\n\n### Translation\n```\n# Sample texts\narticle_en = 'The Secretary-General of the United Nations says there is no military solution in Syria.'\n\nnotre_dame_str = \"As at most other universities, Notre Dame's students run a number of news media outlets. The nine student - run outlets include three newspapers, both a radio and television station, and several magazines and journals. Begun as a one - page journal in September 1876, the Scholastic magazine is issued twice monthly and claims to be the oldest continuous collegiate publication in the United States. The other magazine, The Juggler, is released twice a year and focuses on student literature and artwork. The Dome yearbook is published annually. The newspapers have varying publication interests, with The Observer published daily and mainly reporting university and other news, and staffed by students from both Notre Dame and Saint Mary's College. Unlike Scholastic and The Dome, The Observer is an independent publication and does not have a faculty advisor or any editorial oversight from the University. In 1987, when some students believed that The Observer began to show a conservative bias, a liberal newspaper, Common Sense was published. Likewise, in 2003, when other students believed that the paper showed a liberal bias, the conservative paper Irish Rover went into production. Neither paper is published as often as The Observer; however, all three are distributed to all students. Finally, in Spring 2008 an undergraduate journal for political science research, Beyond Politics, made its debut.\"\n\nbacteria_str = \"Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.\"\n\nbio_str = \"Biology is the science that studies life. What exactly is life? This may sound like a silly question with an obvious answer, but it is not easy to define life. For example, a branch of biology called virology studies viruses, which exhibit some of the characteristics of living entities but lack others. It turns out that although viruses can attack living organisms, cause diseases, and even reproduce, they do not meet the criteria that biologists use to define life.\"\n\nt2t.Translator().transform([\n  article_en,\n  notre_dame_str,\n  bacteria_str,\n  bio_str\n], src_lang='en', tgt_lang='zh')\n\n# Translations\n['\u8054\u5408\u56fd\u79d8\u4e66\u957f\u8bf4,\u53d9\u5229\u4e9a\u6ca1\u6709\u519b\u4e8b\u89e3\u51b3\u65b9\u6848\u3002',\n '\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5927\u5b66\u4e00\u6837,Notre Dame\u7684\u5b66\u751f\u8fd0\u884c\u7684\u65b0\u95fb\u5a92\u4f53\u6e20\u9053\u7684\u6570\u91cf\u3002\u4e5d\u4e2a\u5b66\u751f - \u8fd0\u884c\u7684\u6e20\u9053\u5305\u62ec\u4e09\u4efd\u62a5\u7eb8,\u4e24\u53f0\u5e7f\u64ad\u7535\u89c6\u53f0,\u4ee5\u53ca\u51e0\u672c\u6742\u5fd7\u548c\u6742\u5fd7\u3002 \u5f00\u59cb\u4f5c\u4e3a\u4e00\u4e2a\u4e00\u9875\u7684\u6742\u5fd7\u57281876\u5e749\u6708,\u8be5\u6742\u5fd7\u7684Schoolistic\u53d1\u884c\u4e86\u6bcf\u6708\u4e24\u6b21,\u5e76\u58f0\u79f0\u662f\u7f8e\u56fd\u6700\u53e4\u8001\u7684\u8fde\u7eed\u7684\u5927\u5b66\u65b0\u95fb\u51fa\u7248\u7269,\u548c\u5176\u4ed6\u6742\u5fd7,TheJuggler,\u6bcf\u5e74\u53d1\u884c\u4e24\u6b21,\u5e76\u4e13\u6ce8\u4e8e\u5b66\u751f\u6587\u5b66\u548c\u827a\u672f\u4f5c\u54c1\u3002 \u591a\u59c6\u5e74\u520a\u6bcf\u5e74\u53d1\u884c\u3002 \u62a5\u7eb8\u6709\u4e0d\u540c\u7684\u51fa\u7248\u5229\u76ca,\u4e0eThe Observer\u53d1\u8868\u6bcf\u65e5,\u4e3b\u8981\u62a5\u9053\u5927\u5b66\u548c\u5176\u4ed6\u65b0\u95fb,\u5e76\u7531\u5b66\u751f\u4eceNotre Dame\u548c\u5723\u739b\u4e3d\u7684\u5b66\u9662\u3002 \u4e0eScholastic\u548cThe Dome\u4e0d\u540c,The Observer\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u516c\u4f17\u4f5c\u54c1,\u4f46\u6ca1\u6709\u6559\u5e08\u987e',\n '\u7ec6\u83cc\u662f\u751f\u7269\u7ec6\u80de\u7684\u4e00\u79cd\u7c7b\u578b. \u5b83\u4eec\u6784\u6210\u4e00\u4e2a\u5927\u8303\u56f4\u7684\u4eb2\u751f\u5fae\u751f\u7269. \u901a\u5e38\u51e0\u5fae\u7c73\u957f,\u7ec6\u83cc\u6709\u8bb8\u591a\u5f62\u72b6,\u4ece\u7403\u5230\u6756\u548c\u87ba\u65cb\u3002 \u7ec6\u83cc\u662f\u5730\u7403\u4e0a\u51fa\u73b0\u7684\u7b2c\u4e00\u4e2a\u751f\u547d\u5f62\u5f0f\u4e4b\u4e00,\u5e76\u4e14\u5b58\u5728\u4e8e\u5176\u5927\u591a\u6570\u6816\u606f\u5730\u3002',\n '\u751f\u7269\u5b66\u662f\u7814\u7a76\u751f\u547d\u7684\u79d1\u5b66. \u7a76\u7adf\u4ec0\u4e48\u662f\u751f\u547d? \u8fd9\u53ef\u80fd\u542c\u8d77\u6765\u50cf\u4e00\u4e2a\u611a\u8822\u7684\u95ee\u9898,\u6709\u4e00\u4e2a\u663e\u800c\u6613\u89c1\u7684\u7b54\u6848,\u4f46\u5b83\u5e76\u4e0d\u5bb9\u6613\u5b9a\u4e49\u751f\u547d. \u4f8b\u5982,\u4e00\u4e2a\u540d\u4e3a\u75c5\u6bd2\u5b66\u7684\u751f\u7269\u5b66\u5206\u652f\u7814\u7a76\u75c5\u6bd2,\u8fd9\u4e9b\u75c5\u6bd2\u8868\u73b0\u51fa\u4e00\u4e9b\u6d3b\u4f53\u7684\u7279\u5f81,\u4f46\u7f3a\u4e4f\u5176\u4ed6\u3002']\n```\n\n#### BYOT: Bring Your Own Translator\n * The default translator requires no more than 16GB of memory.\n * You can specify other pretrained translators at your own risk.\n * Make sure src_lang and tgt_lang codes conform to that model.\n\n<details>\n  <summary>BYOT examples</summary>\n\n```\nt2t.Transformer.PRETRAINED_TRANSLATOR = \"facebook/mbart-large-50-many-to-many-mmt\"\nt2t.Transformer.LANGUAGES = {\n  'af_ZA': 'Afrikaans',\n  'ar_AR': 'Arabic',\n  'az_AZ': 'Azerbaijani',\n  'bn_IN': 'Bengali',\n  'cs_CZ': 'Czech',\n  'de_DE': 'German',\n  'en_XX': 'English',\n  'es_XX': 'Spanish',\n  'et_EE': 'Estonian',\n  'fa_IR': 'Persian',\n  'fi_FI': 'Finnish',\n  'fr_XX': 'French',\n  'gl_ES': 'Galician',\n  'gu_IN': 'Gujarati',\n  'he_IL': 'Hebrew',\n  'hi_IN': 'Hindi',\n  'hr_HR': 'Croatian',\n  'id_ID': 'Indonesian',\n  'it_IT': 'Italian',\n  'ja_XX': 'Japanese',\n  'ka_GE': 'Georgian',\n  'kk_KZ': 'Kazakh',\n  'km_KH': 'Khmer',\n  'ko_KR': 'Korean',\n  'lt_LT': 'Lithuanian',\n  'lv_LV': 'Latvian',\n  'mk_MK': 'Macedonian',\n  'ml_IN': 'Malayalam',\n  'mn_MN': 'Mongolian',\n  'mr_IN': 'Marathi',\n  'my_MM': 'Burmese',\n  'ne_NP': 'Nepali',\n  'nl_XX': 'Dutch',\n  'pl_PL': 'Polish',\n  'ps_AF': 'Pashto',\n  'pt_XX': 'Portuguese',\n  'ro_RO': 'Romanian',\n  'ru_RU': 'Russian',\n  'si_LK': 'Sinhala',\n  'sl_SI': 'Slovene',\n  'sv_SE': 'Swedish',\n  'sw_KE': 'Swahili',\n  'ta_IN': 'Tamil',\n  'te_IN': 'Telugu',\n  'th_TH': 'Thai',\n  'tl_XX': 'Tagalog',\n  'tr_TR': 'Turkish',\n  'uk_UA': 'Ukrainian',\n  'ur_PK': 'Urdu',\n  'vi_VN': 'Vietnamese',\n  'xh_ZA': 'Xhosa',\n  'zh_CN': 'Chinese'\n}\nt2t.Translator().transform(\n  [\"I would like to go hiking tomorrow.\"],\n  src_lang=\"en_XX\",\n  tgt_lang='zh_CN'\n)\n['\u6211\u60f3\u660e\u5929\u53bb\u5f92\u6b65\u65c5\u884c\u3002']\n```\n\n</details>\n\n### Data Augmentation / Back-Translation\nBack-translations useful for augmenting training data\n```\nt2t.Variator().transform([bacteria_str], src_lang='en')\n```\n\n<details>\n  <summary>Show results</summary>\n\n```\n# Variations\n['Bacteria are a kind of biological cell. They form a large domain of prokaryotic micro-organisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to borders and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles Chronicles',\n 'Bacteria are a type of biological cell, forming a large scale of procariotic microbials, usually a few micrometers in length, and have many shapes, ranging from bodies to roots and heads, and bacteria were among the first forms of life that appeared on Earth, and they are present in most of their environments.',\n 'The bacteria are a type of biological cell. They constitute a great domain of procariotic microorganisms. Typically a few micrometres of length, the bacteria have a series of shapes, variing from spheres to rays and spirals.',\n 'Bacteria are a type of biological cell. They form a large range of procaryotic microorganisms. Typically, at a length of several micrometers, bacteria have a lot of shapes, between spheres and spirals. Bacteria have been among the first forms of life on Earth, and are in most of its habitats.',\n 'Bacteria type biological cell. They make up a large domain of procariotic microorganisms. typically several micrometers long, bacteria have a number of formats, from spheres to roses and spirals. bacteria were among the first life formats to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are types of biological cells. They make up a great home of procaryotical microorganisms. Usually with a few micrometers of length, bacteria have several shapes that are located from spheres to species and spirals. Bacteria were from the first forms of life that appeared on Earth, and are found in many of their animals.',\n 'Bacteria are a type of biological cell. They make up a large range of procariotic microorganisms. Usually several micrometers in length, bacteria have a number of shapes ranging from spheres to stairs and spirals. Bacteria are among the first forms of life that appear on Earth, and are available in most of its habitats.',\n 'Bacteria are a type of organic cell. They create a larger area of procreatic microorganisms. usually a few micrometers long, the bacteria have a number of sizes, the streets and spirals from the surfers. the bacteria were in the first life sizes appeared on Earth, and present in most of its reality.',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'The bacteria are a type of biological cell.They make a large domain of procarytic microorganisms.Typically a few micrometers long, the bacteria have a number of forms, from spheres to roots and spirals.The bacteria were among the first life forms that appear on Earth, and are present in most of their habitats.',\n 'Bacteria are a type of biological cell. they constitute a great domain of prokarotic microorganisms. Typically a few micrometers of length, the bacteria have a series of shapes, which vary from spheres to wheels and spirals. The bacteria were among the first forms of life that appear on Earth, and are present in most of their habitats.',\n 'The bacteria are a type of biological cell. The bacteria are a different domain of prokaryotic microorganisms. The bacteria are a form, from spheres to wraps and spirals. The bacteria is one of the first life forms of appearance on Earth, and is one of the habitats.',\n 'Bacteria are a type of biological cells. they form a large area of prokaryotic microorganisms. Typically several micrometers in length, bacteria have several shapes, from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its residential spaces.',\n 'Bacteria is a type of biological cell. It is fat in the fat in the prokaryotic microorganisms. The fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat in the fat.',\n 'Bacteria are a type of biological cell. They form a large domain of prokaryotic microorganisms. Typically a couple of micrometers in length, bacteria have a variety of forms, ranging from spheres to layers and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They form a large range of prokaryotic microorganisms. Normally a few micrometers in length, bacteria have a number of forms, from spheres to roots and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of their habitats.',\n 'Bacteria are a kind of organic cells. they make up a large range of prehyroid microorganisms. Usually a few micrometer length, bacteria have a number of forms, ranging from spheres to roots and spherals. The bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to roots and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. they constitute a great domain of procariotic microorganisms. Typically a few micrometers of length, bacteria have a series of shapes, which vary from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',\n 'Bacteria are a type of biological cells. They form a large area of prokarotic microorganisms. usually a few micrometers long, bacteria have a number of forms that range from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',\n 'Bacteria are a type of biological cells.They make up a large range of procaryotic microorganisms.The bacteria usually have a variety of shapes, ranging from branches to branches and spirals.The bacteria were among the first vital forms that appear on earth and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They form a large area of prokaryotic microorganisms. Typically a few micrometers length, bacteria have several forms, ranging from spheres to roots and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitat environments.',\n 'Bacteria are a type of biological cell. They constitute a large range of procaryotic microorganisms. Usually, a few micrometers long, the bacteria have a number of shapes, ranging from spheres to roots and spirals. The bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cells. They set up a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a variety of forms, ranging from spheres to rectum and spirals. Bacteria are among the first forms of life that come to the Earth, and are in the most of their habitats.',\n 'Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced, Inexperienced',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria are a number of shapes, ranges from spheres to roads and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They constitute a great domain of procariotic microorganisms. Typically a few micrometers of length, the bacteria have a series of shapes, which vary from spheres to roots and spirals. The bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',\n 'On the other hand, it is important to note that in the past few decades, there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country, and there is a significant increase in the number of people living in the country.',\n 'Bacteria is a type of biological cell. It has a big domain and prokaryotic microorganisms. It has a micrometres at the time, bacteria has in a number of shapes, ranging from spheres to rods and spirals. Bacteria is in the first and life shapes to appear on Earth, and is in the best and best forms.',\n 'Bacteria are a type of biological cells.They constitute a large area of procreatic microorganisms.Generally a few micrometers long, bacteria have a number of forms, formed from literature to waves and spirals.Bacteria were among the first forms of life to appear on Earth, and they exist in most aspects.',\n 'Bacteria are a type of organic cells. They create a large range of procariotic microorganisms. Usually in a few micrometers length, bacteria have many shapes, ranging from spare to wire and wire. Bacteria were one of the first forms of life that appeared on Earth, and are present in most of their population.',\n 'Bacteria are a type of biological cell. they make a large domain of procarytic microorganisms. usually a few micrometers in length, bacteria have a number of forms, from spheres to roots and spirals. bacteria were among the first forms of life that appear on Earth, and are present in most of their habitats.',\n 'Bacteria are a kind of biological cell. It represents a large domain of pro-cariotic microorganisms. Typically in some micrometres of length, bacteria have a lot of training, from the spheres of their hands and spirals. Bacteria were one of the first training of life appearing in the world, and are present in the majority of their habitats.',\n 'Bacteria are a kind of biological cell. These form a large range of procarytic microorganisms. Generally, some micrometer long bacteria are in a variety of shapes, from spheres to fiber and spirals. Bacteria were among the first forms of life to appear on Earth and are present in most of their habitats.',\n \"Related Topics: Faith  Faith as a Function of Prayer  Faith as Gift of God  Faith, Living  Fasting  Loyalty  Prayer  Prayer as Contact with God  Prayer as Conversation  Prayer as Fellowship  Prayer's Purpose  Prayer, Effectiveness in  Prayer, Power of  Praying Always  Praying at All Times  Praying without Ceasing  Relationship with God  Trust  Unbelief  Weak Prayer Life\",\n 'Bacteria are a type of biological cell. they form a large domain of prokaryotic microorganisms. usually a few micrometers long, bacteria have several shapes, from spheres to roots and spirals. Bacteria are among the first forms of life that appear on Earth, and present in most of its habitats.',\n 'Bacteria is a type of biological cell. It provides a big domain of prokaryotic microorganisms. It provides some micrometres to spread, bacteria has many types, such as spheres and rods and spirals. Bacteria is the primary high-type species to be found on Earth, and is covered by many of its habitats.',\n 'The bacteria is a type of biological cell. The bacteria is a type of bacteria that can be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found to be found.',\n 'Bacteria are a type of biological cells. They are a large area of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of species, ranging from areas to wounds and spirals. Bacteria were among the first biological phenomena to appear on the earth, and are located in the most biological phenomena.',\n 'Bacteria are a type of biological cell. they constitute a wide domain of procariotic microorganisms. usually a few micrometers of length, bacteria have a number of shapes, ranging from spheres to roots and spirals. bacteria are among the first forms of life that appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biocells They make up a wide range of procariotic microorganisms, usually in a number of micrometres of length, bacteria have a variety of shapes from spheres to wings and spirals Bacteria are one of the first forms of life that appear on Earth and are present in most of their habitat.',\n 'Bacteria is a type of biological cell.It is a large domain of prokaryotic microorganisms.Al a few micrometers in length, bacteria have a number of shapes, spread from spheres to grass and spiral.Bacteria are among the first forms of life to be displayed on Earth, and are present in most habitats.',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. (cancer, transport, transport, transport, transport)',\n 'The bacteria have biological cells. They are spread by procariotic microorganisms. The substance has several micrometers, the bacteria have many forms, spheres and spirals.',\n 'Tag is a type of tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag tag',\n 'It is true that there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world, and there is a great deal of interest in the world.',\n 'Bacteria are a type of biological cells.They make up a large range of procariotic microorganisms.In general, a few meters long, the bacteria have several forms from spheres to roots and spheres.The bacteria were one of the first forms of life to appear on Earth, and exist in most ecosystems.',\n 'Bacteria are a type of biological cell. They form a large domain of prokaryotic microorganisms. Typically a few micrometers of length, bacteria have a number of forms, from spheres to spheres and spirals. Bacteria were between the first forms of life and appeared on Earth, and are in the majority of habitats.',\n 'Bacteria is a type of biological cell. They are in a big domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria has a number of shapes, ranging from spheres to roads and spirals. Bacteria was among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot of makolinhot.',\n 'Bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Types of micrometers in the latter, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria were among the first forms of life to appear on Earth, and are renowned in more than its kind.',\n 'Bacteria are a type of biological cells. They make up a large area of procarytic microorganisms. Usually a few micrometers long, bacteria have several forms ranging from spheres to branches and spirals. Bacteria were among the first forms of life that appeared on Earth, and are in many of its habitats.',\n 'Bacteria are a type of biological cells. they form a large range of prokaryotic microorganisms. usually a few micrometers long, bacteria have several shapes, from spheres to roots and spirals. bacteria were among the first forms of life that appeared on Earth, and are located in the majority of its habitat.',\n 'The bacteria is a type of biological cell. It creates a large scale of prokaryotic microorganisms. Usually small, the bacteria have a variety of forms, to spheres and spirals. The bacteria is one of the first forms of life found in the earth, and is present in most of its habitats.',\n 'Bacteria are a type of biological cells. they represent a large area of procariotic microorganisms. Usually several micrometers in length, bacteria have a large number of shapes, ranging from spheres to genes and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',\n 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth.',\n 'Bacteria are a biological pattern. They are a multi-facet of procariotic microorganisms. Moreover, with a micrometer, there are different types of bacteria shapes and spirals. The bacteria was one of the first life patterns in the world and it has a large pattern.',\n 'Bacteria are types of biological cells. They become a large domain of procariotic microbes. Usually some micrometers are long, there are many shapes of bacteria, from spera to spira and spila. Bacteria were the first life shapes to appear on Earth, and are present in most of them.',\n 'Bacteria are a kind of biological cell.They form a large domain of prokaryotic microorganisms.Overall a few micrometers in length, bacteria have several shapes, from spheres to roots and spirals.Bacteria are among the first forms of life that appear on Earth, and present in most of its habitats.',\n 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life shapes to appear on Earth, and are present in most of its habitats. The bacteria kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind kind',\n '\u201cThat\u2019s what I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do, I\u2019m going to do.\u201d',\n 'Bacteria are a kind of biological cell. They form a large domain of prokaryotic microorganisms. Typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rocks and spirals. Bacteria were among the first forms of life that appear on Earth, and are present in most of the habitats.',\n 'Bacteria are a type of biological cell. They form a large area of prokaryotic microorganisms. Usually a few micrometers in length, bacteria have a variety of forms, from spheres to rows and spirals. Bacteria were among the first life forms that appeared on Earth, and are present in most of its habitats.',\n 'small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small small',\n 'Bacteria are a type of biological cell, they constitute a large range of procariotic microorganisms, typically micrometers long, bacteria are a variety of shapes, from spheres to wheels and spirals, and bacteria are among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to roads and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria is a kind of bacteria. They have a large area of prokaryotic microorganisms. Usually some micrometers are a kind of bacteria, from fresh to color and from fresh. Bacteria as first bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria as bacteria.',\n 'Bacteria are a type of biological cells. they make up a large area of prokaryotic microorganisms. usually a few micrometers long, bacteria have a number of shapes, from spheres to corners and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell. They form a large range of procariotic microorganisms. In the usual length of several micrometers, bacteria have many shapes, from shapes to colors and spirals. Bacteria are in the first life shapes that appear on earth, and are present in many beauty.',\n 'Bacteria are a type of biological cell. they constitute a great domain of procarotic microorganisms. typically, some micrometers of length, the bacteria have a number of shapes, ranging from spheres to roots and spirals. the bacteria were among the first forms of life that appeared on Earth, and are present in most of their habitats.',\n 'Bacteria are a type of biological cell. they constitute a large range of procariotic microorganisms. usually, at a few micrometers of length, bacteria have a number of forms, from spheres to rows and spirals. bacteria have been among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cells. They make up a large domain of procariotic microorganisms. As a rule, several micrometers in length, bacteria have a number of forms, from spheres to births and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of their fields.',\n 'Bacteria is a section of biological negative. These are a large section of procariotic microorganisms. Generally, in the length of several micrometers, bacteria are in different forms, in sperm and sperm. Bacteria were in the earlier life forms of appearance on earth, and most of them are in life.',\n 'bacteria are a type of biological cell. They constitute a large domain of prokaryotic microorganisms. typically a few micrometers in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. bacteria were among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats. bacteria are among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cells. they form a large area of prokaryotic microorganisms. Typically several micrometers in length, bacteria have several shapes, ranging from spheres to tribes and spirals. Bacteria were among the first forms of life that appeared on Earth, and are present in most of its living places.',\n 'Bacteria are a type of biological cell. they make up a large area of procarotic microorganisms. Usually a few micrometres of length, bacteria have a number of forms, from the sphere to the wings and spirals. Bacteria were among the first life forms that occur on Earth, and are present in most of their habitats.',\n 'Bakteer is from mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid to mid',\n 'Bacteria are a type of biological cells.They make up a large range of prokaryotic microorganisms.Typically some micrometers in length, bacteria have a number of forms, dispersing from the sphere to the root and spirals.Bacteria were among the first forms of life that appeared on Earth, and are present in most of its habitats.',\n 'Bacteria are a type of biological cell.They make up a large domain of procariotic microorganisms.Generally a few micrometers in length, bacteria have a range of shapes, ranging from spheres to genes and spirals.Bacteria were among the first forms of life that appear on Earth, and are present in most of its habitats.',\n 'Bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria, bacteria',\n 'Bacteria are a type of biological cell. They have a large domain of prokaryotic microorganisms. Usually a few micrometers long, bacteria have a number of shapes, spreading from spheres to roots and spirals. Bacteria are among the first forms of life that appear on Earth, and are in most habitats.',\n 'Bacteria are a type of biological cell. They make up a large area of prokaryotic microorganisms. Usually a few micrometers in length, bacteria have a number of forms, ranging from spheres to rows and spirals. Bacteria were among the first forms of life to appear on Earth, and are present in most of its habitats.',\n 'Bacteria are a kind of biological cell. They make a large area of prokaryotic microorganisms. Usually several micrometres of time, bacteria have several varieties, from spheres to color and spirals. Bacteria were among the first kinds of life to appear on the earth, and are present in many parts of its environment.',\n 'This is the first time I\u2019ve been able to do it, and I\u2019ve been able to do it, I\u2019ve been able to do it, I\u2019ve been able to do it, I\u2019ve been able to do it, I\u2019ve been able to do it.',\n 'Bacteria are a type of biological cells. They generate a large area of prokaryotic microorganisms. Normally, several micrometers, the bacteria have multiple shapes from round to round and round. The bacteria is one of the first forms of life that appears on the earth and is found in most of its environment.',\n 'The bacteria are a type of biological cell. These are a large domain of prokaryotic microorganisms. Typically in some micrometres of length, the bacteria have a number of shapes, from spheres to wraps and spirals. The bacteria are one of the first forms of life emerging on Earth, and are available in more habitats.',\n 'Go and go and go and go and go and go and go and go.',\n 'Bacteria are a biological type of cell. They form a large range of procaryotic microorganisms. typically in a few micrometers length, bacteria have a series of shapes, from spheres to roots and spirals. Bacteria have been among the first forms of life that appear on Earth and are present in most of their living areas.',\n 'Bacteria are a type of biological cells. they form a large sphere of procariotic microorganisms. As a rule, a few micrometers of length, bacteria have a number of forms that vary from spheres to cows and spirals. Bacteria were among the first forms of life that appear on Earth, and present in most of its vital objects.',\n 'Bacteria are a section of biological cells, they build a large place of procaryotic microorganisms, generally in a range of several micrometers, there are a large number of bacteria shapes, from spiders to wrinkles and spirals, bacteria were one of the first forms of life that appeared on earth, and are present in most populations.',\n 'Bacteria are biological cells. They accumulate prokaryotic microorganisms. In a typical micrometer length, bacteria accumulate from sphera to sphera to sphera. Bacteria were one of the first forms of life on Earth, and are present in most biologies.',\n 'Bacteria are a type of biological cell. They form a large range of prokaryotic microorganisms. Usually, a few micrometres in length, bacteria have a number of shapes, from crystals to roots and crystals. bacteria are one of the first forms of life appearing on Earth, and present in most of its organisms.',\n 'Bacteria is a type of biological cell. They constitute a large domain of prokaryotic microorganisms. Typically a few micrometres in length, bacteria have a number of shapes, ranging from spheres to rods and spirals. Bacteria was among the first life forms to appear on Earth, and are present in most of its habitats. Bacteria were among the first life forms to appear on Earth, and are present in most of its habitats.',\n 'The bacteria is a type of biological cell. The bacteria are prokaryotic microorganisms. According to many micrometres, the bacteria are many forms, from spheres to roads and spirals. The bacteria are the first life forms to appear on Earth, with many habitats.',\n 'Bacteria is a type of biological cell. They represent a large area of prokaryotic microorganisms. Types of a little micrometer in the acteria, bacteria have a number of forms, refer to spheres and spirals. Bacteria are among the first life forms to appear on Earth, and are present in most of the bacteria.',\n 'Bakteries are a type of biological cell. They were the best of prokaryotic microorganisms. They were one of the many micrometres, the bacteria are a lot of processes, from processes and processes. Bakteries are one of the processes of processes that are processed on Earth, and they are processed in all processes.',\n 'Bacteria are a type of biocells, they make up a large area of probiotic microorganisms, usually several meters long bacteria have several shapes, from branches to roots and spirals, bacteria are one of the first forms of life that appear on Earth and are present in most of their habitats.',\n 'The bacteria is a type of biological cells. The bacteria is a large area of prokaryotic microorganisms. The bacteria is a long micrometres, the bacteria is a spheres in roads and spirals. The bacteria is among the data, data, data, data and data.']\n```\n\n</details>\n\n### Training / Finetuning\nFinetune cross-lingual model on your data\n```\nresult = t2t.Fitter().transform([\"Hello, World! [TGT] \u4f60\u597d,\u4e16\u754c!\"],\n  src_lang=\"en\",\n  tgt_lang=\"zh\",\n  num_epochs=10,\n  save_directory=\"model_dir\"\n)\n\n# load and use model from saved directory\nt2t.Transformer.PRETRAINED_TRANSLATOR = \"model_dir\"\nt2t.Translator().transform(\"Hello, World!\", src_lang=\"en\", tgt_lang=\"zh\")\n```\n\n### Identification\nIdentify the language of a text. Not yet accurate for short sequences (<10 tokens)\n```\nt2t.Identifier().transform([\"Aj ke\u010f sa Buzz Aldrin stal a\u017e \u201edruh\u00fdm \u010dlovekom\u201c, ktor\u00fd otla\u010dil svoju nohu do povrchu Mesiaca...\",])\n\n# Prediction\n`['sk', 'Slovak']`\n```\n\n### Serving\nWe aim to serve all functionality above\n```\n# Start web server\nt2t.Server(host='0.0.0.0', port=80)\n\n# Make POST requests\nimport socket\nimport requests\n\naddress = socket.gethostbyname(socket.getfqdn(socket.gethostname()))\nurl = f\"http://{address}\"\ntransformer = \"Translator\"\npayload = {\n  \"input_lines\": [\"hello\", \"world\"],\n  \"src_lang\": \"en\",\n  \"tgt_lang\": \"ko\",\n}\nr = requests.post(f\"{url}/{transformer}\", json=payload)\nprint(r.json()) #{'result': ['\uc548\ub155\ud558\uc138\uc694', '\uc138\uacc4']}\n\n# Indexer actions\nr = requests.post(f\"{url}/Indexer/add\", json=payload)\nr = requests.post(f\"{url}/Indexer/size\")\nr = requests.post(f\"{url}/Indexer/search\", json=payload)\nr = requests.post(f\"{url}/Indexer/retrieve\", json=payload)\npayload[\"ids\"] = [0,1]\nr = requests.post(f\"{url}/Indexer/remove\", json=payload)\n```\n\n## Questions?\nFor questions or help using Text2Text, please submit a [GitHub issue](https://github.com/artitw/text2text/issues).\n\n## Citation\nTo cite this work, use the following BibTeX citations.\n```\n@article{stfidf,\n  doi = {10.48550/ARXIV.2209.14281},\n  url = {https://arxiv.org/abs/2209.14281},\n  author = {Wangperawong, Artit},\n  title = {Multilingual Search with Subword TF-IDF},\n  publisher = {arXiv},\n  year = {2022},\n}\n```\n```\n@misc{text2text@2020,\n  author={Wangperawong, Artit},\n  title={Text2Text Language Modeling Toolkit},\n  year={2020},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/artitw/text2text}},\n  url = {https://github.com/artitw/text2text}\n}\n```\n\n## Contributing\nThere are many ways you can [contribute](https://github.com/artitw/text2text/blob/master/CONTRIBUTING.md):\n1. Ask or answer a question in [Issues](https://github.com/artitw/text2text/issues)\n2. Share your experiences on using Text2Text\n3. Report bugs with information to reproduce\n4. Request for new features or functionality\n5. Improve code by submitting a [pull request](https://github.com/artitw/text2text/pulls) with outputs demonstrating the change\n6. See [projects](https://github.com/artitw/text2text/projects), comment on a task issue to get involved\n\n## Code of Conduct\nPlease adhere to our [code of conduct](https://github.com/artitw/text2text/blob/master/CODE_OF_CONDUCT.md) when participating in this project.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Text2Text Language Modeling Toolkit",
    "version": "1.8.3",
    "project_urls": {
        "Homepage": "https://github.com/artitw/text2text"
    },
    "split_keywords": [
        "multilingual",
        "gpt",
        "chatgpt",
        "bert",
        "natural",
        "language",
        "processing",
        "nlp",
        "nlg",
        "text",
        "generation",
        "gpt",
        "question",
        "answer",
        "answering",
        "information",
        "retrieval",
        "tfidf",
        "tf-idf",
        "bm25",
        "search",
        "index",
        "summary",
        "summarizer",
        "summarization",
        "tokenizer",
        "tokenization",
        "translation",
        "backtranslation",
        "data",
        "augmentation",
        "science",
        "machine",
        "learning",
        "colab",
        "embedding",
        "levenshtein",
        "sub-word",
        "edit",
        "distance",
        "conversational",
        "dialog",
        "chatbot",
        "llama",
        "rag"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bed80f4f19f2c1043b6acc750ec307cb4abcde9d4a5f8b6efdbedc6824e51dee",
                "md5": "53e604093723e150ca9913a247124b39",
                "sha256": "af3ae0921aee58cda75e7ce7bf451246c27b3d169ddfe408224d6dab07118ee0"
            },
            "downloads": -1,
            "filename": "text2text-1.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "53e604093723e150ca9913a247124b39",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 35249,
            "upload_time": "2024-10-29T01:24:11",
            "upload_time_iso_8601": "2024-10-29T01:24:11.582147Z",
            "url": "https://files.pythonhosted.org/packages/be/d8/0f4f19f2c1043b6acc750ec307cb4abcde9d4a5f8b6efdbedc6824e51dee/text2text-1.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "427c201301e42eab33921f883fd6c2fa5d572ef7b398d0482920c9d327188d12",
                "md5": "4b451c2acadb6721213c6abcf3f7cf97",
                "sha256": "ee48ed3d06cdcba7f85ee658ee1c1453b524dceecb78a534108916ee3c3644ac"
            },
            "downloads": -1,
            "filename": "text2text-1.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4b451c2acadb6721213c6abcf3f7cf97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 52903,
            "upload_time": "2024-10-29T01:24:13",
            "upload_time_iso_8601": "2024-10-29T01:24:13.279166Z",
            "url": "https://files.pythonhosted.org/packages/42/7c/201301e42eab33921f883fd6c2fa5d572ef7b398d0482920c9d327188d12/text2text-1.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 01:24:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "artitw",
    "github_project": "text2text",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "text2text"
}
        
Elapsed time: 0.61136s