Here is the concept of a script that can compare two dictionaries with each other. The first dictionary uses grapheme elements which are in upper case letters, the second dictionary distinguishes between upper case and lower case. If there is a corresponding entry in the second dictionary, the entry of the first dictionary will be set to lower case in the resulting output tree. Here is the script:
<?php
// Compare the grapheme elements of two dictionaries
if (file_exists(‘general-american-dictionary.xml’)) {
$xml = simplexml_load_file(‘general-american-dictionary.xml’);
$english = simplexml_load_file(‘english-dictionary.xml’);
foreach ($xml->lexeme as $lexeme) {
$grapheme = $lexeme->grapheme;
foreach ($english->lexeme as $lexemeenglish) {
$graphemeenglish = $lexemeenglish->grapheme;
if ($grapheme == strtoupper($graphemeenglish)) {
$grapheme = $graphemeenglish;
}
}
echo $grapheme, ‘ ‘, $lexeme->phoneme, PHP_EOL;
}
} else {
exit(‘Failed to open general-american-dictionary.xml.’);
}
?>
Of course, this script is not yet finished. This script is working very slow, but never mind.










