Skip to content

Commit fa38add

Browse files
committed
Create word2word.ipynb
1 parent 59d1b3f commit fa38add

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed

Projects/Word2Word/word2word.ipynb

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from word2word import Word2word"
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"## French"
17+
]
18+
},
19+
{
20+
"cell_type": "code",
21+
"execution_count": 2,
22+
"metadata": {},
23+
"outputs": [
24+
{
25+
"name": "stdout",
26+
"output_type": "stream",
27+
"text": [
28+
"['pomme', 'pommes', 'pommier', 'tartes', 'fleurs']\n"
29+
]
30+
}
31+
],
32+
"source": [
33+
"en2fr = Word2word(\"en\", \"fr\")\n",
34+
"print(en2fr(\"apple\"))"
35+
]
36+
},
37+
{
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"## Dutch\n"
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": 3,
47+
"metadata": {},
48+
"outputs": [
49+
{
50+
"name": "stdout",
51+
"output_type": "stream",
52+
"text": [
53+
"['huis', 'thuis', 'wonen']\n"
54+
]
55+
}
56+
],
57+
"source": [
58+
"en2nl = Word2word(\"en\", \"nl\")\n",
59+
"print(en2nl(\"house\",n_best=3))"
60+
]
61+
},
62+
{
63+
"cell_type": "markdown",
64+
"metadata": {},
65+
"source": [
66+
"## Hindi"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 4,
72+
"metadata": {},
73+
"outputs": [
74+
{
75+
"name": "stdout",
76+
"output_type": "stream",
77+
"text": [
78+
"['बुद्धिमान', 'था...', 'रिच्ची', 'बुद्धिमानी', 'प्रतीयमान']\n"
79+
]
80+
}
81+
],
82+
"source": [
83+
"en2hi = Word2word(\"en\", \"hi\")\n",
84+
"print(en2hi(\"intelligent\", n_best = 5))"
85+
]
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"metadata": {},
90+
"source": [
91+
"## Finnish"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": 6,
97+
"metadata": {},
98+
"outputs": [],
99+
"source": [
100+
"en2fi = Word2word(\"en\", \"fi\")"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": 7,
106+
"metadata": {},
107+
"outputs": [
108+
{
109+
"name": "stdout",
110+
"output_type": "stream",
111+
"text": [
112+
"['Minusta', 'hyviä', 'se', 'on']\n"
113+
]
114+
}
115+
],
116+
"source": [
117+
"print(en2fi(\"artificial\", n_best = 5))"
118+
]
119+
},
120+
{
121+
"cell_type": "markdown",
122+
"metadata": {},
123+
"source": [
124+
"## Chineze"
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": 9,
130+
"metadata": {},
131+
"outputs": [
132+
{
133+
"name": "stdout",
134+
"output_type": "stream",
135+
"text": [
136+
"['愚蠢', '哑巴', '哑', '聋', '蠢蛋']\n"
137+
]
138+
}
139+
],
140+
"source": [
141+
"en2cn = Word2word(\"en\", \"zh_cn\")\n",
142+
"print(en2cn(\"dumb\", n_best = 5))"
143+
]
144+
},
145+
{
146+
"cell_type": "code",
147+
"execution_count": null,
148+
"metadata": {},
149+
"outputs": [],
150+
"source": []
151+
}
152+
],
153+
"metadata": {
154+
"kernelspec": {
155+
"display_name": "Python 3",
156+
"language": "python",
157+
"name": "python3"
158+
},
159+
"language_info": {
160+
"codemirror_mode": {
161+
"name": "ipython",
162+
"version": 3
163+
},
164+
"file_extension": ".py",
165+
"mimetype": "text/x-python",
166+
"name": "python",
167+
"nbconvert_exporter": "python",
168+
"pygments_lexer": "ipython3",
169+
"version": "3.6.5"
170+
}
171+
},
172+
"nbformat": 4,
173+
"nbformat_minor": 2
174+
}

0 commit comments

Comments
 (0)