 Salá programme oyo eko détecter plagiat na texte.
Tala programme ya Python ya pete oyo ekoki ko détecter plagiat na texte na ko vérifier similarité entre deux textes en utilisant méthode ya similarité ya cosine: ```python import string import math from collections import Counter def clean_text(text): # kolongola bilembo text = text. translate(str.maketrans('', '', string.punctuation)) # kolongola esika ya pembe ya likolo mpe kosala bilembo nyonso makomi mike text = text.strip().lower() zongisa texte def cosine_similarity(text1, text2): # kosukola text text1 = clean_text(text1) text2 = clean_text(text2) # kosala tokenizing ya texte mpe kosala ensemble ya maloba unique words1 = text1.split(" ") words2 = text2.split(" ") unique_words = set(words1).union (set(words2)) # kosala dictionnaire pona kotanga fréquence ya maloba freq1 = dict.fromkeys(unique_words, 0) freq2 = dict.fromkeys(unique_words, 0) # kotanga fréquence ya maloba na makomi nionso mibale pona liloba na maloba1: freq1 [liloba] += 1 mpo na liloba na maloba2: freq2[liloba] += 1 # kosala calcul ya bokokani ya cosine dot_product = somme([freq1[liloba] * freq2[liloba] mpo na liloba na maloba_unique]) magnitude1 = math.sqrt(sum( [freq1[liloba]**2 mpo na liloba na freq1])) magnitude2 = math.sqrt(sum([freq2[liloba]**2 mpo na liloba na freq2])) bokokani = dot_product / (magnitude1 * magnitude2) zongisa bokokani text1 = "Lolenge ya plagiat oyo ezali komonana mingi na mosala ya mikanda ezali kosala copie na nko mpe ya polele ya mosala mosusu" text2 = "Kosala copie na nko mpe ya polele ya mosala mosusu na bokomi ya mikanda ezali lolenge ya polele ya plagiat" threshold = 0.7 similarity = cosine_similarity( text1, text2) if similarity > threshold: print("Mokanda oyo ekoki kozala na plagiat.") else: print("Mokanda oyo ezali ya ebandeli.") ``` Programme oyo esukolaka liboso makomi na kolongola bilembo ya bopemi mpe bisika ya pembe ya kobakisa mpe esalaka nyonso bilembo ya mikemike. Na nsima, esalaka calcul ya bokokani ya cosine kati na makomi yango mibale na kotánga fréquence ya maloba na makomi nyonso mibale mpe kozwaka mbuma ya ba points ya ba vecteurs ya fréquence oyo ekabolami na mbuma ya bonene na yango. Soki bokokani eleki seuil moko boye (na likambo oyo 0,7), programme etalaka makomi