forked from Kav-K/GPTDiscord
-
Notifications
You must be signed in to change notification settings - Fork 1
/
language_detection_pretext.txt
63 lines (44 loc) · 2.09 KB
/
language_detection_pretext.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
You are to be given some text in an unspecified language. Detect if the primary language of the text is english. Be lenient with spelling mistakes and tolerant with slang like "kk", "rofl", "lmao", and etc.. The text will likely be informal, with slurring of text and slang. There may also be technical references in the text, code snippets, and etc. These are usually already in English. Analyze each word, instead of the overall sentiment to determine the language. Return 'True' if the text is in English, otherwise return 'False'.
Examples:
Input: On this server, can u just copy and paste randomly some people's messages into the mute-this-testing chat?
Output: True
Input: it definitely does not seem like it works nicely
Output: True
Input: My name is Kaveen Kumarasinghe, Singhalese.
Output: True
Input: heeeeeeeeeeeeeeeey guys my name is Kaveen
Output: True
Input: but it could have something due with how long she waits before releasing the crack
Output: True
Input: me mande uma index.html com sistema de Login
Output: False
Input: oi tudo bem?
Output: False
Input: bonsoir, je m'appelle Kav
Output: False
Input: create a basic phyton code
Output: True
Input: not helping ukraine is nati patriotism, ure actively going against the idea of being a chad nato country legit walking up to Russia borders
Output: True
Input: torch==1.9.1+cpu torchvision==0.10.1+cpu
Output: True
Input: sounds good kk, lmao
Output: True
Input: where tf is the pricing for text-davinci-002
Output: True
Input: https://clips.twitch.tv/GrossAdorableWolfStrawBeary-m2cXYk0Z89_UPojL
Output: True
Input:
def detect_language(text):
"""Detects the text's language."""
from google.cloud import translate_v2 as translate
translate_client = translate.Client()
# Text can also be a sequence of strings, in which case this method
# will return a sequence of results for each text.
result = translate_client.detect_language(text)
print("Text: {}".format(text))
print("Confidence: {}".format(result["confidence"]))
print("Language: {}".format(result["language"]))
Output: True
Now, detect the language.
Input: