Termiz davlat universiteti Intellectual texnologiyalar fakulteti




Download 106,13 Kb.
Sana14.05.2024
Hajmi106,13 Kb.
#232201
Bog'liq
15-mustaqil ta\'lim

Termiz davlat universiteti


Intellectual texnologiyalar fakulteti
KI-123 guruh talabasi
Ahmadbek Nazarovning
MT ishi



  1. MT.Tashqi kutubxonalar ustida amallar

  1. Matnni rus tiliga tarjima qilish.

pip install googletrans
from googletrans import Translator
matn_uz="Python - dunyodagi eng mashxur dasturlash tili"
tarjima_ru = tarjimon.translate(matn_uz, dest='ru')
print(tarjima_ru.text)

2.ingliz tilidagi matnni o’zbek tiliga tarjima qilish.


pip install googletrans
from googletrans import Translator
matn_en = "Tashkent is the capital of Uzbekistan"
tarjima_uz = tarjimon.translate(matn_en, dest='uz')
print(tarjima_uz.text)

3.matn tilini alohida ko’rsatib tarjima qilish.


tarjima_uz = tarjimon.translate(matn_en, src='uz', dest='uz')
print(tarjima_uz.text)

4.requests yordamida kun.uz sahifasini to'liqligicha tortibb olish
import requests
from pprint import pprint
manzil= "https://kun.uz/news/main"
r = requests.get(manzil)
pprint(r.text)



  1. restcountries.eu sahifasida API so’rov yuborish.

country = "Uzbekistan"
url = f"https://restcountries.eu/rest/v2/name/{country}"
r = requests.get(url)
r_json = r.json()[0]
print(r_json['capital'])
6.bs4 yordamida html sahifadan oxirgi yangiliklarning mavzusini ajratib olish..
import requests
from bs4 import BeautifulSoup
sahifa = "https://kun.uz/news/main"
r = requests.get(sahifa)


soup = BeautifulSoup(r.text, 'html.parser')
news = soup.find_all(class_="news-title") # yangiliklarning mavzusini ajratib olish
print(news[0].text) # eng birinchi yangilikni konsolga chiqarish



  1. kun.uz sahifasidan olingan yangiliklar uchun so'zlar bulutini yaratish



import requests


from bs4 import BeautifulSoup
from wordcloud import WordCloud
import matplotlib.pyplot as plt
sahifa = "https://kun.uz/news/main"
r = requests.get(sahifa)


soup = BeautifulSoup(r.text, 'html.parser')
news = soup.find_all(class_="news-title")
matn=""
for n in news:
matn += n.text


# kerakmas so'zlar
stopwords=["учун","бўйича","лекин","билан","ва","бор","ҳам","хил",# bulutni yaratish
wordcloud = WordCloud(width = 1000, height = 1000,
background_color ='white',
stopwords = stopwords,
min_font_size = 20).generate(matn)

# plot the WordCloud image
plt.figure(figsize = (8, 8), facecolor = None)
plt.imshow(wordcloud)
plt.axis("off")
plt.tight_layout(pad = 0)
plt.show()



  1. sozlarni bir-biri bilan solishtirish.

from fuzzywuzzy import fuzz
print(fuzz.ratio("salom",'assalom'))
print(fuzz.ratio("salom","salim"))


  1. so'zlar orasidan o'xshash so'zlarni topish.

from fuzzywuzzy import process
from uzwords import words

text = "салом"
matches = process.extract(text, words, limit=3)
print(matches)


  1. yagona so'zni tanlab olish.

from fuzzywuzzy import process
from uzwords import words

text = "telba"
match = process.extractOne(text,words)
print(match)

10.Matnni rus tiliga tarjima qilish.
pip install googletrans
from googletrans import Translator
matn_uz="Python - dunyodagi eng mashxur dasturlash tili"
tarjima_ru = tarjimon.translate(matn_uz, dest='ru')
print(tarjima_ru.text)

11.ingliz tilidan o’zbek tiliga tarjima qilish.
from googletrans import Translator
matn_en = "Tashkent is the capital of Uzbekistan"
tarjima_uz = tarjimon.translate(matn_en, dest='uz')
print(tarjima_uz.text)


  1. ingliz tilidan rus tiliga tarjima qilish.

matn_en = "Tashkent is the capital of Uzbekistan"
tarjima_ru = tarjimon.translate(matn_en, dest='ru')
print(tarjima_ru.text)


  1. tarjimon dastur yaratish .

import wx
from googletrans import Translator
tarjimon = Translator()
class MyFrame(wx.Frame):
def __init__(self):
super().__init__(parent=None, title='Oʻzbek-Ingliz Lugʻat')
panel = wx.Panel(self)
my_sizer = wx.BoxSizer(wx.VERTICAL)
self.text_ctrl = wx.TextCtrl(panel)
my_sizer.Add(self.text_ctrl, 0, wx.ALL | wx.EXPAND, 5)
my_btn=wx.Button(panel,label='TARJIMA') my_btn.Bind(wx.EVT_BUTTON,self.on_press) my_sizer.Add(my_btn, 0, wx.ALL | wx.CENTER, 5)
self.text_out=wx.TextCtrl(panel,style=wx.TE_READONY) my_sizer.Add(self.text_out,0,wx.ALL|wx.EXPAND,5) panel.SetSizer(my_sizer)
self.Show()
def on_press(self, event):
value = self.text_ctrl.GetValue()
if not value:
self.text_out.SetValue("Soʻz kiritmadingiz")
else:
tarjima = tarjimon.translate(value,src='uz',dest='en') self.text_out.SetValue(tarjima.text.capitalize())
if __name__ == '__main__':
app = wx.App() frame = MyFrame() app.MainLoop()


  1. daryo sayti yangiliklarini yuklab olish.

import requests
from pprint import pprint
manzil= "https://kun.uz/news/main"
r = requests.get(manzil)
pprint(r.text)


  1. rus tilidan ingliz tiliga matnni tarjima qilish.

matn_ru = "Ташкент-столица Узбекистана"
tarjima_en = tarjimon.translate(matn_ru, dest='en')
print(tarjima_en.text)
Download 106,13 Kb.




Download 106,13 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Termiz davlat universiteti Intellectual texnologiyalar fakulteti

Download 106,13 Kb.