FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
All-In-One-Python-Projects/Translator/translate.py at main · GHubPythonProjects/All-In-One-Python-Projects · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
GHubPythonProjects
/
All-In-One-Python-Projects
Public
forked from
king04aman/All-In-One-Python-Projects
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
All-In-One-Python-Projects
/
Translator
/
translate.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (19 loc) · 715 Bytes
Breadcrumbs
All-In-One-Python-Projects
/
Translator
/
translate.py
Copy path
File metadata and controls
23 lines (19 loc) · 715 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from
tabulate
import
tabulate
from
googletrans
import
Translator
class
TranslateClass
(
object
):
def
__init__
(
self
,
word
,
lang
):
self
.
word
=
word
self
.
lang
=
lang
self
.
Trans
=
Translator
(
service_urls
=
[
"translate.google.com"
])
def
__repr__
(
self
):
translated
=
self
.
Trans
.
translate
(
self
.
word
,
dest
=
self
.
lang
).
text
data
=
[
[
'Language:'
,
"Sentence"
],
[
'English'
,
self
.
word
],
[
'Hindi'
,
str
(
translated
)]]
table
=
str
(
tabulate
(
data
,
headers
=
"firstrow"
,
tablefmt
=
"grid"
))
return
table
if
__name__
==
'__main__'
:
translate
=
input
(
'Enter Sentence: '
)
language
=
'hi'
print
(
TranslateClass
(
translate
,
language
))
Back
|
FazBrowse Home
|
New Git URL