sentence | language |
Hello, do you know what time the movie is tonight? | english |
I am calling to make reservations | english |
I would like to know if it is at all possible to check in | english |
What time does the swimming pool open? | english |
Where is the games room? | english |
We must call the police. | english |
How many pupils are there in your school? | english |
Twenty litres of unleaded, please. | english |
Is it near here? | english |
Do I have to change? | english |
Which counter do I go to to change money? | english |
I would like two postcards, please. | english |
There was a big explosion. | english |
Where is the television room? | english |
Where's the nearest railway station? | english |
The storms caused flooding. | english |
Where is the duty free shop? | english |
I witnessed it happening. | english |
I would like two postcards, please. | english |
How about going to the cinema? | english |
Où est la boulangerie? | french |
Je voudrais une boîte de chocolats. | french |
Y a-t-il un autre hôtel près d'ici? | french |
Vérifiez la batterie, s'il vous plaît. | french |
La banque ouvre à quelle heure? | french |
Est-ce que je peux l'écouter? | french |
Vous devez faire une déclaration de perte. | french |
Combien d'élèves y a-t-il dans votre collège? | french |
Est-ce qu-il y a un car qui va à l'aéroport? | french |
Nous voudrions rester jusqu'Ã dimanche prochain. | french |
Je ne comprends pas. | french |
Voici une ordonnance pour des comprimés. | french |
Je n'ai qu'un billet de cinquante francs. | french |
À quelle heure commence la dernière séance? | french |
Faut-il changer? | french |
Il n'avait pas la priorité. | french |
Puis-je prendre les places à l'avance? | french |
Elle a trente et un ans. | french |
Pour aller à la pharmacie, s'il vous plaît? | french |
Voulez-vous me peser ce colis, s'il vous plaît. | french |
Ciao, ti va di andare al cinema? | italian |
Mi sai dire quando aprono il negozio? | italian |
Quando c'è l'ultimo autobus? | italian |
Lo posso provare addosso? | italian |
C'è una presa elettrica per il nostro caravan? | italian |
Vorrei una scatola di cioccolatini. | italian |
Non e' stata colpa mia. | italian |
Sono molto scarso in fisica. | italian |
Vorrei del vino bianco. | italian |
Me lo puo' spiegare, per piacere. | italian |
Vorrei chiamare a spese del ricevente. | italian |
Ho perso il mio passaporto. | italian |
Posso avere i biglietti del cinema per favore? | italian |
Vorrei un pacchetto di biscotti. | italian |
Quali materie studi (studia)? | italian |
Quanto frequenti sono gli autobus? | italian |
A che ora sara' la prossima raccolta? | italian |
Vorrei prenotare un posto. | italian |
Per favore, quanto costa spedire una lettera in Germania? | italian |
Mio padre e' un programmatore. | italian |
code sbb:
<?php declare(strict_types=1); namespace PhpmlExamples; include 'vendor/autoload.php'; use Phpml\Dataset\CsvDataset; use Phpml\Dataset\ArrayDataset; use Phpml\FeatureExtraction\TokenCountVectorizer; use Phpml\Tokenization\WordTokenizer; use Phpml\CrossValidation\StratifiedRandomSplit; use Phpml\FeatureExtraction\TfIdfTransformer; use Phpml\Metric\Accuracy; use Phpml\Classification\SVC; use Phpml\SupportVectorMachine\Kernel; $dataset = new CsvDataset('data/languages.csv', 1); $vectorizer = new TokenCountVectorizer(new WordTokenizer()); $tfIdfTransformer = new TfIdfTransformer(); $samples = []; foreach ($dataset->getSamples() as $sample) { $samples[] = $sample[0]; //echo $sample[0]."<br>"; } $vectorizer->fit($samples);//samples=array cetak0($samples); $vectorizer->transform($samples); //cetak($samples); $tfIdfTransformer->fit($samples); $tfIdfTransformer->transform($samples); //cetak($samples); $dt=$dataset->getTargets();//english,italia,french //cetak0($dt); $dataset = new ArrayDataset($samples, $dt);//object //vard($dataset); $randomSplit = new StratifiedRandomSplit($dataset, 0.1); //vard($randomSplit); $classifier = new SVC(Kernel::RBF, 10000); $AA=$randomSplit->getTrainSamples(); $BB=$randomSplit->getTrainLabels(); echo"<h1>Samples - Label</h1>"; //cetak($AA); //echo"<hr>"; //cetak0($BB); $CC=$randomSplit->getTestSamples(); //echo"<hr>"; //cetak($CC); $DD=$randomSplit->getTestLabels(); echo"<hr>"; cetak0($DD); $classifier->train($AA, $BB); $predictedLabels = $classifier->predict($CC); echo"<hr>"; cetak0($predictedLabels); echo 'Accuracy: '.Accuracy::score($DD, $predictedLabels); function tipe($x){ echo gettype($x)."<hr>"; return ""; } function vard($x){ echo var_dump($x)."<hr>"; return ""; } function cetak($x){ $p=count($x); for($i=0;$i<$p;$i++){ $q=count($x[$i]); for($j=0;$j<$q;$j++){ echo $x[$i][$j]."#"; } echo"<br>"; } return ""; } function cetak0($x){ $p=count($x); for($i=0;$i<$p;$i++){ echo $x[$i]."#"; } return ""; } ?>
Samples - Label
download code
english#english#french#french#italian#italian#
english#english#french#french#italian#italian#Accuracy: 1
Tidak ada komentar:
Posting Komentar