Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

texte vergleichen

Empfohlene Antworten

Veröffentlicht

mal n neuer versuch:

also: ich habe 2 texte. für jeden text wird aufgeschrieben, wie oft ein bestimmtes wort vorkommt.

die einzelnen wörter werden als key und die jeweilige anzahl als entsprechende value gespeichert.

wie schaffe ich es, dass dies dieser BEISPIELnotation enspricht (soll natürlich algemein bleiben):

Code:


$a = array("a" => 2, "b"=> 2, "c"=>5);
$b = array("b"=>5,"c"=>13);
[/PHP]

hier mein "Versuch":

Code:

[PHP]
$key = explode(" ", $zzz1a);
$value = explode(" ", $zzz1b);
$a[] = array('$key[]' => '$value[]');

$key2 = explode(" ", $zzz2a);
$value2 = explode(" ", $zzz2b);
$b[] = array('$key2[]' => '$value2[]');

jetzt werden die beiden texte auf Ähnlichkeit berechnet. Dies klappt mit der BEISPIELnotation, aber nicht mit meinen "Versuch". -> Was muss ich bei meinen "Versuch" ändern?

(ab hier muss nichts mehr geändert werden, ist nur zur besseren Verständlichkeit, wie es weiterverarbeitet wird.)

Code:


foreach ($a as $key => $value)
{
if ($b[$key]<>0)
{
if ($value < $b[$key])
{
echo $key." = ".($value/$b[$key])."%<br>";
}
else
{
echo $key." = ".($b[$key]/$value)."%<br>";
}
}
else
{
echo $key." = 0%<br>";
}
}

[/PHP]

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.