paint-brush
Ngaba udiniwe nguSiri ngokubhala igama lakho? Nantsi Ulungiso oluLulange@philhopkins
333 ukufunda
333 ukufunda

Ngaba udiniwe nguSiri ngokubhala igama lakho? Nantsi Ulungiso oluLula

nge Philip Hopkins6m2024/12/14
Read on Terminal Reader

Inde kakhulu; Ukufunda

Ukubetha i-Apple kunye neSiri kumdlalo wokubhala kunye nokuthumela iitekisi
featured image - Ngaba udiniwe nguSiri ngokubhala igama lakho? Nantsi Ulungiso oluLula
Philip Hopkins HackerNoon profile picture
0-item

Ndine-iPhone iminyaka elishumi, kwaye ndiyayithanda. Ngokungafaniyo nabanye abantu, ndiyayonwabela iSiri kwaye ndiyisebenzisa rhoqo. Kodwa emva kweminyaka elishumi, uSiri khange acinge ukuba xa ebhala iitekisi zam, kufuneka azi ukuba igama lomfazi wam akangoAron, nguErin. Ndiyakuxolela ukuphunyezwa kwentetho-to-text, eyona nto ibaluleke kakhulu, kodwa emva kokuba ndilungise loo mpazamo kanye kwaye ndithumele isicatshulwa esihlaziyiweyo, ukuba ukulungiswa kufuneka kugcinwe kwimbali yokulungiswa kwifowuni yam-ifayile encinci esetyenziswe yiposi. -processing transformer model, kunye nezinye izikhokelo, ukwenza le mpazamo incinci kakhulu. Ndiyazi ukuba ukubiza intetho ye-iPhone kumsebenzi wombhalo uSiri ulula kakhulu, kodwa yindlela abantwana bam bacinga ngayo 'i-AI kwi-iPhone yam.'


Iinkqubo zokuthetha-ukuya-kumbhalo zidla ngokusokola kwii-homophones-amagama avakala ngendlela efanayo kodwa aneendlela ezahlukeneyo zokupela kunye neentsingiselo. Ezi mpazamo zinokudanisa, ngakumbi xa zichaphazela amagama abantu okanye amagama asetyenziswa ngokuqhelekileyo. Isitshixo ekulungiseni le ngxaki asikho ekulungiseni ngakumbi i-injini yokuqonda intetho kodwa kubunzima obukhaphukhaphu, umaleko wokusetyenzwa kombhalo wasemva koshicilelo olungelelanisa izilungiso zomsebenzisi ekuhambeni kwexesha. Nantsi ikhowudi esekwe kwiPyTorch endiyiyile ukulungisa le nto.


Icwecwe kakhulu kwaye kulula ukuyihambisa kwifowuni emva kokuqulunqa iselfowuni. Ndiyazi ukuba ngasemva kweSiri kukho iseti entsonkothileyo kakhulu yeemodeli ezibotshelelweyo, ke le khowudi inokusetyenziselwa ukubonelela ngophawu olutsha njengegalelo kwezo modeli, amanqaku anceda ukwenza ushicilelo lube lolwakho xa kuvela iihomophones ezithile. Kodwa kuya kuba lula ukusebenzisa oku njengomaleko wokusetyenzwa kweposi.

Oku akufuneki ukuba kulinde ukukhutshwa kwefowuni entsha ukuba kufakwe. Iya kwenza ubomi bube ngcono kum kuhlaziyo olulandelayo olukhutshwa yiApple kwi-iPhone yam.

Ingcamango engundoqo

Le ndlela igxile kwizinto ezintathu eziphambili:

  • Imbali yoLungiso: Igcina izilungiso zabasebenzisi bangaphambili, amagama aphambili abekwe ngumsebenzisi ngokucacileyo ngaphambili.
  • Abafowunelwa Rhoqo: Landela amagama asetyenziswa rhoqo okanye amagama, ukunika amathuba aphezulu kulawo asetyenziswa ngokuqhelekileyo.
  • Uhlalutyo lomxholo: Usebenzisa inkqubo yoLwimi lweNdalo (NLP) ukuhlalutya isicatshulwa esijikelezileyo ukuze ufumane imikhondo enceda ukungazinzi ii-homophones.


Inkqubo ibala inqaku elinokubakho kumviwa ngamnye we-homophone ngokusekwe kwezi zinto zintathu kwaye ikhethe elona lungiso lunokwenzeka. Apha ngezantsi kuphunyezo lwePython olwahlulwe lwangamacandelo aneenkcazo.

Ilayisha iDatabase yeeHomophones

Inyathelo lokuqala kukudala okanye ukulayisha i-database yee-homophones. Ezi zizibini zamagama (okanye amaqela) anokuthi abhideke ngexesha loshicilelo.


 # Homophones database homophones_db = { "Aaron": ["Erin"], "bare": ["bear"], "phase": ["faze"], "affect": ["effect"], }

Esi sisichazi-magama esilula apho isitshixo ligama elikhutshelwe ngokungachanekanga, kwaye ixabiso lululuhlu lwezinye iindlela zehomophone. Umzekelo, "isigaba" sinokubhidaniswa ne "faze". Kamva, le database iya kubuzwa xa kufunyenwe igama elintsonkothileyo.

Ukulandelela Imbali yoLuleko

Ikhowudi ilandelela izilungiso zomsebenzisi kwisichazi-magama apho isitshixo ngasinye siyituple ye (original_word, corrected_word) kwaye ixabiso libalo lamaxesha umsebenzisi alungise loo mpazamo.

Umkhondo wembali yokulungisa

 # Correction history tracker correction_history = { ("phase", "Faye's"): 3, ("bear", "bare"): 2, }


Ukuba umsebenzisi ulungisa "isigaba" ku-"Faye's" amaxesha amathathu, inkqubo ibeka phambili oku kulungiswa kubhaliso lwexesha elizayo.

Abafowunelwa rhoqo

Enye into ephembelela ukhetho lwe-homophone kukuba igama elithile lisetyenziswa kangaphi. Oku kungamagama omntu okanye amagama umsebenzisi ahlala echwetheza rhoqo.

 # Frequent contact tracker frequent_contacts = { "faye": 15, "phase": 5, "erin": 10, "aaron": 2, }

Inkqubo inika ubunzima obuthe kratya kumagama asetyenziswa rhoqo xa kungacaciswa ii-homophones. Umzekelo, ukuba "faye" ivela ka-15 kodwa "phase" ivela ka-5 kuphela, kuya kukhethwa "faye".

Uhlalutyo lwemeko

Imikhondo yomxholo itsalwa kwisivakalisi esijikelezileyo ukucokisa ngakumbi ukhetho. Umzekelo, ukuba isivakalisi siqulathe isimelabizo esithi "she", inkqubo ingakhetha u"Erin" kuno"Aron". ukusuka kumbhobho wokungenisa ii-transformers

Layisha imodeli ye-NLP yohlalutyo lomxholo

 from transformers import pipeline # Load an NLP model for context analysis context_analyzer = pipeline("fill-mask", model="bert-base-uncased") def detect_context(sentence): """Detect context-specific clues in the sentence.""" pronouns = ["he", "she", "his", "her", "their"] tokens = sentence.lower().split() return [word for word in tokens if word in pronouns]

Lo msebenzi uhlola isivakalisi ukuze ufumane izimelabizo zesini okanye ezinye izikhokelo ezinokubonisa intsingiselo ekujoliswe kuyo yegama.

Ukubala Amanqaku Anokwenzeka

Umviwa ngamnye we-homophone unikwe amanqaku okunokwenzeka ngokusekwe koku:

  1. Izilungiso ezidlulileyo : Ubunzima obuphezulu (umz., 3x).
  2. Ukusetyenziswa rhoqo : Ubunzima obuphakathi (umzekelo, 2x).
  3. Umxholo ohambelanayo : Ubunzima obusezantsi (umz., 1x).
 def calculate_likelihood(word, candidate, sentence): """Calculate a likelihood score for a homophone candidate.""" correction_score = correction_history.get((word, candidate), 0) * 3 frequency_score = frequent_contacts.get(candidate, 0) * 2 context = detect_context(sentence) context_clues = homophones_db.get(candidate, []) context_score = sum(1 for clue in context if clue in context_clues) return correction_score + frequency_score + context_score

Eli nqaku lidibanisa izinto ezintathu ukumisela eyona homophone enokwenzeka.

Ukungazinzi iiHomophones

Ngamanqaku okunokwenzeka abalwayo, inkqubo ikhetha i-homophone enawona manqaku aphezulu.

 def prioritize_homophones(word, candidates, sentence): """Prioritize homophones based on their likelihood scores.""" likelihoods = { candidate: calculate_likelihood(word, candidate, sentence) for candidate in candidates } return max(likelihoods, key=likelihoods.get) def disambiguate_homophone(word, sentence): """Disambiguate homophones using likelihood scores.""" candidates = homophones_db.get(word, []) if not candidates: return word return prioritize_homophones(word, candidates, sentence)


Le nkqubo iqinisekisa elona gama lifanelekileyo likhethwa ngokusekwe kwimbali, amaxesha amaninzi, kunye nomxholo.

Kusetyenzwa ngokuPheleleyo okuKhutshelweyo

Inkqubo iqhuba isivakalisi siphela, isebenzisa ingqiqo yokungacacisi igama ngalinye.

 def process_transcription(transcription): """Process the transcription to correct homophones.""" words = transcription.split() corrected_words = [disambiguate_homophone(word, transcription) for word in words] return " ".join(corrected_words)

Umzekelo opheleleyo wokuhamba komsebenzi

 # Example transcription and correction raw_transcription = "This is phase one plan." corrected_transcription = process_transcription(raw_transcription) print("Original Transcription:", raw_transcription) print("Corrected Transcription:", corrected_transcription) # Simulate user feedback update_correction_history("phase", "faye") print("Updated Correction History:", correction_history) print("Updated Frequent Contacts:", frequent_contacts)

Ukuhlaziya iNgxelo

Xa umsebenzisi elungisa impazamo, imbali yolungiso kunye nabafowunelwa rhoqo bayahlaziywa ukuphucula uqikelelo lwexesha elizayo.


 def update_correction_history(original, corrected): """Update correction history and frequent contacts.""" correction_history[(original, corrected)] = correction_history.get((original, corrected), 0) + 1 frequent_contacts[corrected] = frequent_contacts.get(corrected, 0) + 1 frequent_contacts[original] = max(0, frequent_contacts.get(original, 0) - 1)

Umzekelo wokukhutshelwa kunye nokulungiswa

 Original Transcription: This is phase one plan. Corrected Transcription: This is Faye's one plan. Updated Correction History: {('phase', 'Faye's'): 4} Updated Frequent Contacts: {'Faye's': 16, 'phase': 4}

Ukuqukumbela

Lo maleko wokulungiswa kwetekisi ukhaphukhaphu uphucula ukuchaneka kosetyenziso lwentetho ukuya kumbhalo ngokufunda kwizilungiso zabasebenzisi, ukuxhasa ukusetyenziswa rhoqo, kunye nokuhlalutya umxholo. Ixinene ngokwaneleyo ukuba isebenze kwizixhobo eziphathwayo kwaye ilungelelaniswe neemfuno zomsebenzisi ngamnye, inika enye indlela ekrelekrele kwiimodeli ezimileyo zemveli. Ngomzamo omncinci, i-Apple-okanye nayiphi na enye inkampani-inokudibanisa oku kusebenza ukwenza abancedisi abanjengoSiri baphendule ngakumbi kwaye benziwe umntu.

L O A D I N G
. . . comments & more!

About Author

Philip Hopkins HackerNoon profile picture
Philip Hopkins@philhopkins
I am a hacker, engineer, product manager, and researcher on LLMs, AI/ML, and the ethics of applied machine learning.

ZIJONGE IIMPAWU

ELI NQAKU LINIKEZELWE KU...