Helper Functions
//----------------------------
function removeSuffix($word, $suffixes, $suffixes_T, $suffixRemoved) {
foreach ($suffixes as $i => $suffix) {
if (substr($word, -strlen($suffix)) === $suffix) {
$suffixRemoved = [$suffix, $suffixes_T[$i]];
if ($i == 0) {
echo ' | Tense: ';
}
for ($is = 0; $is <= 13; $is++) {
if ($suffix == $SUFF6[$is] && $PREF2[$is] == substr($word, 0, 1)) {
echo ' | Emphatic II: | Form: ' . $is . ' | ' . $SUBJ_PRO_TRANS[$is] . ' | ' . $NUMBER[$is] . ' | ' . $GENDER[$is] . ' | ';
} elseif ($suffix == $SUFF4[$is] && $PREF2[$is] == substr($word, 0, 1)) {
echo ' | Jussive: | Form: ' . $is . ' | ' . $SUBJ_PRO_TRANS[$is] . ' | ' . $NUMBER[$is] . ' | ' . $GENDER[$is] . ' | ';
} elseif ($suffix == $SUFF3[$is] && $PREF2[$is] == substr($word, 0, 1)) {
echo ' | Subjunctive: | Form: ' . $is . ' | ' . $SUBJ_PRO_TRANS[$is] . ' | ' . $NUMBER[$is] . ' | ' . $GENDER[$is] . ' | ';
} elseif ($suffix == $SUFF2[$is] && $PREF2[$is] == substr($word, 0, 1)) {
echo ' | Imperfect: | Form: ' . $is . ' | ' . $SUBJ_PRO_TRANS[$is] . ' | ' . $NUMBER[$is] . ' | ' . $GENDER[$is] . ' | ';
}
}
//---------------------------
for ($id = 0; $id <= 20; $id++) {
if ($suffix == $DEC_SUFF[$id]) {
echo ' | Noun | ' . $id . ' | ' . $DEC_STATUS[$id] . ' | ';
}
}
return substr($word, 0, -strlen($suffix));
}
}
$suffixRemoved = ['', ''];
return $word;
}
//--------------------------
function removeDuplicates($word, $removedLetter) {
echo '
Original Word: ' . $word;
$wordAfterDuplicate=$word;
// Step 1: Check if the last three letters are duplicates
$length = strlen($word);
if ($length >= 3) {
$lastThree = substr($word, -3);
if ($lastThree[0] === $lastThree[1] && $lastThree[1] === $lastThree[2]) {
// Do not remove duplicates if the last three letters are identical
//echo '
Last three letters are identical, no duplicates removed: ' . $wordAfterDuplicate;
//$removedLetter = null;
return $wordAfterDuplicate;
}
}
// Step 2: Explicitly check for duplicates at earlier positions
for ($i = 0; $i < $length - 3; $i++) {
if ($word[$i] === $word[$i + 1]) {
// Remove one duplicate letter
$removedLetter = $word[$i];
$wordAfterDuplicate = substr_replace($word, '', $i, 1);
echo '
Duplicate letter removed: '.$removedLetter.'';
//echo '
Word after removing duplicates: ' . $wordAfterDuplicate;
break; // Only remove the first detected duplicate
}
}
// Output final word after processing
//echo '
Final Word after Duplicate Removal: ' . $wordAfterDuplicate;
return $wordAfterDuplicate;
}
//-------------------------
function generateTransformations($root) {
$additions = ['e', 'w', 'y']; // Characters to combine
$transforms = [];
// Case 1: Three roots provided (e.g., ktb)
if (strlen($root) === 3) {
$transforms[] = $root; // No transformations required
}
// Case 2: Two roots provided (e.g., kt)
if (strlen($root) === 2) {
$letters = str_split($root);
// Insert `e`, `w`, `y` at the first, second, and third positions
foreach ($additions as $add) {
$transforms[] = $add . $letters[0] . $letters[1]; // Insert at first position
$transforms[] = $letters[0] . $add . $letters[1]; // Insert at second position
$transforms[] = $letters[0] . $letters[1] . $add; // Insert at third position
}
// Add a transformation by repeating the second root as the third root
$transforms[] = $letters[0] . $letters[1] . $letters[1];
}
// Case 3: One root provided (e.g., k)
if (strlen($root) === 1) {
// Generate pairs of unique additions (two at a time)
$pairs = [];
foreach ($additions as $i => $first) {
for ($j = $i + 1; $j < count($additions); $j++) {
$second = $additions[$j];
$pairs[] = [$first, $second];
$pairs[] = [$second, $first];
}
}
// Place the root at each of the three positions
foreach ($pairs as $pair) {
$transforms[] = $root . $pair[0] . $pair[1]; // Root at the first position
$transforms[] = $pair[0] . $root . $pair[1]; // Root at the second position
$transforms[] = $pair[0] . $pair[1] . $root; // Root at the third position
}
}
return array_unique($transforms); // Ensure unique transformations
}
//------------------------------
function findTranslation($root, $C1, $C2, $C3, $wpresent, $C1_T, $C2_T, $C3_T) {
// Generate all possible transformations if the root has less than 3 letters
$transformedRoots = [];
if (strlen($root) === 3) {
$transformedRoots[] = $root; // No transformations needed for a three-letter root
} elseif (strlen($root) === 2) {
// Generate possible three-letter combinations for two-letter roots
$additions = ['e', 'w', 'y'];
$letters = str_split($root);
foreach ($additions as $add) {
$transformedRoots[] = $add . $letters[0] . $letters[1]; // Insert at first position
$transformedRoots[] = $letters[0] . $add . $letters[1]; // Insert at second position
$transformedRoots[] = $letters[0] . $letters[1] . $add; // Insert at third position
}
// Add transformation by repeating the second root letter
$transformedRoots[] = $letters[0] . $letters[1] . $letters[1];
}
// Iterate over all transformed roots and check for translations
foreach ($transformedRoots as $transformedRoot) {
[$root1, $root2, $root3] = str_split($transformedRoot); // Split into components
for ($i = 0; $i < count($C1); $i++) {
// Check if the transformed root matches the database entry
if ($transformedRoot === $C1[$i] . $C2[$i] . $C3[$i]) {
echo '
Matched Root: ' . $transformedRoot;
return [
'translation' => $wpresent[$i],
'arabic' => $C1_T[$i] . $C2_T[$i] . $C3_T[$i]
];
}
}
}
// No translation found
return null;
}
//--------------------------
function markersRemoval($wordAfterDuplicate, $prefixes, $prefixes_T, $prefixRemoved) {
$vowels = ['a', 'i', 'u', 'A', 'y', 'w']; // Define middle markers
$markers = ['', '']; // To store the first and second middle markers
global $word;
//echo '
Original Word: ' . $wordAfterDuplicate;
// Step 1: Remove Prefix (if applicable)
if (!empty($prefixRemoved)) {
$wordAfterDuplicate = substr($wordAfterDuplicate, strlen($prefixRemoved));
//echo '
Prefix Removed: ' . $prefixRemoved;
//echo '
Word After Prefix Removal: ' . $wordAfterDuplicate;
}
// Step 2: Remove Middle Markers (one at a time)
$processedWord = $wordAfterDuplicate; // Track the word after marker removal
for ($i = strlen($processedWord) - 1; $i >= 0; $i--) {
$letter = $processedWord[$i];
if (in_array($letter, $vowels)) {
$processedWord = substr_replace($processedWord, '', $i, 1); // Remove the marker
//echo '
Word After Removing Marker (' . $letter . '): ' . $processedWord;
// Store the marker in the markers array
if (empty($markers[0])) {
$markers[0] = $letter; // First Marker - SMM
//echo '
Secondary Middle Marker: '.$markers[0].'';
} elseif (empty($markers[1])) {
$markers[1] = $letter; // Second marker - FMM
//echo '
First Middle Marker: '.$markers[1].'';
}
}
}
$firstM=$markers[1];
$secondM=$markers[0];
if($firstM=='u' && $secondM=='i')echo ' | Tense: Passive';
if($firstM=='aA' && $secondM=='i')echo ' | Chapter: III or VI';
if($firstM=='uw' && $secondM=='i')echo ' | Chapter: III Passive';
// Step 3: Extract the last three letters as the root
$wordAfterSMM = substr($processedWord, -3);
echo '
Final Transformed Root: ' . $wordAfterSMM . '';
//echo '
First Root: '.substr($wordAfterSMM,0,1).'';
//echo '
Second Root: '.substr($wordAfterSMM,1,1).'';
//echo '
Third Root: '.substr($wordAfterSMM,2,1).'';
if(strlen($word)>=5)if(substr($word,0,5)=='musta')echo ' | Participle Chapter X';
if(strlen($word)>=5)if(substr($word,0,5)=='eista')echo ' | Verbal Noun Chapter X';
if(strlen($word)>=4)if(substr($word,0,4)=='muta' && $marker[0]=='i')echo ' | Active Participle';
if(strlen($word)>=3)if(substr($word,0,3)=='mun')echo ' | Participle Chapter VII';
if(strlen($word)>=2)if(substr($word,0,2)=='ma')echo ' | Type | Noun of Place';
if(strlen($word)>=2)if(substr($word,0,2)=='mi' && substr($word,0,3)!='min')echo ' | Noun of Instrument';
if(strlen($word)>=2)if(substr($word,0,2)=='mu' && $marker[0]=='i')echo ' | Active Participle';
return $wordAfterSMM;
}
//----------------------------
function processWord($word, $suffixes, $suffixes_T, $prefixes, $prefixes_T, $FMM, $FMM_T, $SMM, $SMM_T, $C1, $C2, $C3, $wpresent, $C1_T, $C2_T, $C3_T) {
global $NUMBER, $GENDER,$SUBJ_PRO,$SUBJ_PRO_T,$SUBJECT_PRO_TRANS;
//echo '
Original Word: '.$word.'';
if(substr($word,0,2)=='ma')echo ' | Type | Noun of Place';
if(substr($word,0,2)=='mi' && substr($word,0,3)!='min')echo ' | Noun of Instrument';
if(substr($word,0,3)=='mun')echo ' | Participle Chapter VII';
if(substr($word,0,5)=='musta')echo ' | Participle Chapter X';
if(substr($word,0,5)=='eista')echo ' | Verbal Noun Chapter X';
$wordAfterSuffix = removeSuffix($word, $suffixes, $suffixes_T, $suffixRemoved);
echo '
Suffix: {'.$suffixRemoved[0].'}
Word After Suffix Removal: '.$wordAfterSuffix.' | ({'.$suffixRemoved[1].'})';
$wordAfterDuplicate = removeDuplicates($wordAfterSuffix, $removedLetter);
if($removedLetter!=NULL){
echo '
Duplicate Letter: '.$removedLetter.'';
//echo '
Word After Duplicate Letter Removal: '.$wordAfterDuplicate.'';
}
$wordAfterSMM=markersRemoval($wordAfterDuplicate, $prefixes, $prefixes_T, $prefixRemoved);
$transformations = generateTransformations($wordAfterSMM);
$matches = [];
foreach ($transformations as $transformation) {
$translation = findTranslation($transformation, $C1, $C2, $C3, $wpresent, $C1_T, $C2_T, $C3_T);
if ($translation) {
$matches[] = [
'root' => $transformation,
'translation' => $translation['translation'],
'arabic' => $translation['arabic']
];
}
}
foreach ($matches as $match) {
echo ' | Roots in Color: '.substr($match['root'],0,1).''.substr($match['root'],1,1).''.substr($match['root'],2,1).'';
echo '
Root: {'.$match['root'].'} - Translation: {'.$match['translation'].'} - Arabic: {'.$match['arabic'].'}';
}
if (empty($matches)) {
echo "
Final Transformed Root: None - Translation: No Translation";
}
}//end of function processword
//------------------------------
function removePrefix($word, $prefixes, $prefixes_T, $prefixRemoved) {
foreach ($prefixes as $i => $prefix) {
if (strpos($word, $prefix) === 0) {
$prefixRemoved = [$prefix, $prefixes_T[$i]];
echo '
Prefix: '.$prefixRemoved[0].' '.$prefixRemoved[1].'';
$pr=$prefixRemoved[0];
if($prefixRemoved[0]=='musta')echo '
Noun Chapter X';
if($prefixRemoved[0]=='eisti')echo '
Verbal Noun Chapter X';
if($prefixRemoved[0]=='easta' ||$prefixRemoved[0]=='nasta' ||$prefixRemoved[0]=='tasta' ||$prefixRemoved[0]=='yasta' || $prefixRemoved[0]=='eusta' ||$prefixRemoved[0]=='nusta' ||$prefixRemoved[0]=='tusta')echo '
Imperfect Tense Chapter X';
if($prefixRemoved[0]=='eista')echo '
Verb Chapter X';
if($prefixRemoved[0]=='muta')echo '
Noun Chapter V or Chapter VI';
if($prefixRemoved[0]=='eata' ||$prefixRemoved[0]=='nata' ||$prefixRemoved[0]=='tata' ||$prefixRemoved[0]=='yata' ||$prefixRemoved[0]=='euta' ||$prefixRemoved[0]=='nuta' ||$prefixRemoved[0]=='tuta' ||$prefixRemoved[0]=='yuta')echo '
Verb Chapter V or Chapter VI';
if($prefixRemoved[0]=='mun')echo '
Noun Chapter VII';
if($prefixRemoved[0]=='ein')echo '
Perfect/Noun Chapter VII';
if($prefixRemoved[0]=='ean'||$prefixRemoved[0]=='nan'||$prefixRemoved[0]=='tan'||$prefixRemoved[0]=='yan')echo '
Imperfect Chapter VII';
return $prefixRemoved[0];
}
}
$prefixRemoved = ['', ''];
return $word;
}
function matchOneArray($word, $array1, $array1_T, $array1_TRANS, $type1) {
// Sort the array by length in descending order
// Check for a match in the array
foreach ($array1 as $g1) {
if ($word === $g1) {
// Find the index of the match
$index = array_search($g1, $array1);
// Retrieve corresponding translations and types
$arabicRepresentation = $array1_T[$index];
$translation = $array1_TRANS[$index];
// Display results
echo '
'.$word.'
Group: ' . $type1 .
' | Matched: ' . $g1 .'
Arabic: ' . $arabicRepresentation .'
Translation: ' . $translation . '';
$status='match found';
return $status; // Indicate a match was found
}
}
}
function analyze_prefix($pd){
if($pd=='musta')echo '
Noun Chapter X';
if($pd=='eisti')echo '
Verbal Noun Chapter X';
if($pd=='easta' ||$pd=='nasta' ||$pd=='tasta' ||$pd=='yasta' || $pd=='eusta' ||$pd=='nusta' ||$pd=='tusta')echo '
Imperfect Tense Chapter X';
if($pd=='eista')echo '
Verb Chapter X';
if($pd=='muta')echo '
Noun Chapter V or Chapter VI';
if($pd=='eata' ||$pd=='nata' ||$pd=='tata' ||$pd=='yata' ||$pd=='euta' ||$pd=='nuta' ||$pd=='tuta' ||$pd=='yuta')echo '
Verb Chapter V or Chapter VI';
if($pd=='mun')echo '
Noun Chapter VII';
if($pd=='ein')echo '
Perfect/Noun Chapter VII';
if($pd=='ean'||$pd=='nan'||$pd=='tan'||$pd=='yan')echo '
Imperfect Chapter VII';
return;
}
function matchTwoArrays($word, $array1, $array1_T, $array1_TRANS, $array2, $array2_T, $array2_TRANS, $type1, $type2) {
// Sort both arrays by length in descending order for longest first
// Check combinations of one member from each array
foreach ($array1 as $g1) {
foreach ($array2 as $g2) {
$combined = $g1 . $g2;
if ($word === $combined) {
// Find indexes
$index1 = array_search($g1, $array1);
$index2 = array_search($g2, $array2);
// Retrieve corresponding values
$arabicRepresentation1 = $array1_T[$index1];
$translation1 = $array1_TRANS[$index1];
$arabicRepresentation2 = $array2_T[$index2];
$translation2 = $array2_TRANS[$index2];
// Construct result array
$result = [
'word' => $word,'g1' => $g1,'g2' => $g2,
'arabic1' => $arabicRepresentation1,'translation1' => $translation1,'type1' => $type1,'arabic2' => $arabicRepresentation2,'translation2' => $translation2,
'type2' => $type2
];
// Display results
echo '
' . implode(' | ', [
'Word: ' . $result['word'],
''.$result['g1'].'',
''.$result['g2']. '',
'Arabic: '.$result['arabic1'].''. $result['arabic2'].'',
'Translation: ' . $result['translation1'] . ', ' . $result['translation2'] . '',
'
G1: '.$result['type1'].'',
'
G2: '.$result['type2'].''
]);
return; // Return the result array
}
}
}
}
function matchThreeArrays($word, $array1, $array1_T, $array1_TRANS, $array2,$array2_T, $array2_TRANS, $array3, $array3_T, $array3_TRANS, $type1, $type2, $type3) {
// Sort all arrays by length in descending order
/* usort($array1, function($a, $b) {
return strlen($b) - strlen($a);
});
usort($array2, function($a, $b) {
return strlen($b) - strlen($a);
});
usort($array3, function($a, $b) {
return strlen($b) - strlen($a);
});
*/
// Check combinations of one member from each array
foreach ($array1 as $g1) {
foreach ($array2 as $g2) {
foreach ($array3 as $g3) {
$combined = $g1 . $g2 . $g3;
if ($word === $combined) {
// Find indexes
$index1 = array_search($g1, $array1);
$index2 = array_search($g2, $array2);
$index3 = array_search($g3, $array3);
// Retrieve Arabic representations and translations
$arabicRepresentation1 = $array1_T[$index1];
$translation1 = $array1_TRANS[$index1];
$arabicRepresentation2 = $array2_T[$index2];
$translation2 = $array2_TRANS[$index2];
$arabicRepresentation3 = $array3_T[$index3];
$translation3 = $array3_TRANS[$index3];
// Display results
echo '
' . implode(' | ', [
'Word: '.$word, // Original word
''.$g1.''.$g2.''.$g3.' '.$arabicRepresentation1.''.$arabicRepresentation2.''.$arabicRepresentation3.'
G1: '.$type1, $g1.'. | '.$arabicRepresentation1.' | '.$translation1.' | ',
'
G2: '.$type2,' | '.$g2.' | '.$arabicRepresentation2.' | '.$translation2
, // Type for second
'
G3: '.$type3, ' | '.$g3.' | '.$arabicRepresentation3.' | '.$translation3 //
]);
return ; // Return after finding the first match
}
}
}
}
//echo '
No match found using Match Three Arrays';
//echo 'No match found';
return null;
}
function mergeTwoSuffixes($word, $array1, $array1_T, $array1_TRANS, $array2, $array2_T, $array2_TRANS, $type1, $type2) {
// Sort all arrays by length in descending order
usort($array1, function($a, $b) {
return strlen($b) - strlen($a);
});
usort($array2, function($a, $b) {
return strlen($b) - strlen($a);
});
// Check combinations of one member from each array
foreach ($array1 as $g1) {
foreach ($array2 as $g2) {
$combined = $g1 . $g2;
if ($word === $combined) {
// Find indexes
$index1 = array_search($g1, $array1);
$index2 = array_search($g2, $array2);
// Retrieve Arabic representations and translations
$arabicRepresentation1 = $array1_T[$index1];
$translation1 = $array1_TRANS[$index1];
$arabicRepresentation2 = $array2_T[$index2];
$translation2 = $array2_TRANS[$index2];
// Display results
echo '
' . implode(' | ', [
'Word: '.$word, // Original word
''.$g1.''.$g2.' | '.$arabicRepresentation1.''.$arabicRepresentation2.'
'.$g1.'', // First match
$arabicRepresentation1, // Arabic for first
$translation1, // Translation for first
$type1, // Type for first
'
'.$g2.'', // Second match
$arabicRepresentation2, // Arabic for second
$translation2, // Translation for second
$type2]); // Type for second
return true; // Return after finding the first match
}
}
}
// No match found
//echo 'No match found';
return null;
}
function mrSuffixes($word, $array1, $array1_T, $array1_TRANS, $type1) {
// Sort the array by length in descending order
global $SUFF1,$SUFF2,$SUFF3,$SUFF4,$SUFF5,$SUFF6,$SUFF1_T,$SUFF2_T,$SUFF3_T,$SUFF4_T,$SUFF5_T,$SUFF6_T,$GENDER,$NUMBER,$SUBJ_PRO_TRANS,$DEC_SUFF,$DEC_SUFF_T,$DEC_STATUS;
usort($array1, function($a, $b) {
return strlen($b) - strlen($a);
});
// Check each suffix in the array
foreach ($array1 as $g1) {
// Check if the word ends with the suffix
if (substr($word, -strlen($g1)) === $g1) {
$remainingWord = substr($word, 0, -strlen($g1));
// Find the index of the suffix
$index1 = array_search($g1, $array1);
// Retrieve Arabic representation and translation
//$arabicRepresentation1 = $array1_T[$index1];
//$translation1 = $array1_TRANS[$index1];
// Display results
echo '
' . implode(' | ', [
//'
Original Word: ' . $word,
'
1. Remaining Word: ' . $remainingWord,
'
Suffix: ' . $g1 . '',
//'
Arabic: ' . $arabicRepresentation1 . '',
//'
Translation: ' . $translation1 . '',
'
Group: ' . $type1,
]);
for($k=0;$k<=13;$k++){
if($g1==$SUFF1[$k])echo 'Perfect '.$SUFF1_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k] ;
if($g1==$SUFF2[$k])echo '
| Imperfect ['.$k.']: '.$SUFF2_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF3[$k])echo '
| Subjunctive Imperfect ['.$k.']: '.$SUFF3_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF4[$k])echo ' | Jussive Imperfect ['.$k.']: '.$SUFF4_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF5[$k])echo ' | Emphatic I Imperfect ['.$k.']: '.$SUFF5_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF6[$k])echo ' | Emphatic II Imperfect ['.$k.']: '.$SUFF6_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1=='')echo 'Jussive Tense ['.$k.']';
}
for($m=0;$m<=23;$m++){
if($g1==$DEC_SUFF[$m])echo ' | Noun ['.$m.']: '.$DEC_SUFF_T[$m].' | '.$DEC_STATUS[$m];
}
return $remainingWord;// Exit after finding the first match
}
}
// No match found
//echo "No suffix match found in the word '$word'.";
}
function mrSuffixesObjectives($word, $array1, $array2, $type1, $type2) {
global $GENDER,$NUMBER,$SUBJ_PRO_TRANS,$OBJ_PRO,$SUFF1,$SUFF2,$SUFF3,$SUFF4,$SUFF5,$SUFF6,$DEC_SUFF,$DEC_SUFF_T,$DEC_STATUS,$GEN_PRO,$OBJ_PRO_TRANS;
// Sort all arrays by length in descending order
usort($array1, function($a, $b) {
return strlen($b) - strlen($a);
});
usort($array2, function($a, $b) {
return strlen($b) - strlen($a);
});
// Check combinations of one member from each array
foreach ($array1 as $g1) {
foreach ($array2 as $g2) {
// Check if the word ends with the combined suffix
$combinedSuffix = $g1 . $g2;
if (substr($word, -strlen($combinedSuffix)) === $combinedSuffix) {
$remainingWord = substr($word, 0, -strlen($combinedSuffix));
// Find indexes
$index1 = array_search($g1, $array1);
$index2 = array_search($g2, $array2);
// Display results
echo '
' . implode(' | ', [
//'
Original Word: ' . $word,
'
1. Remaining Word: ' . $remainingWord,
'' . $g1 . '' . $g2 . '',
//'
G1: ' . $type1,' | Group 2: ' . $type2
]);
//echo '
Suffix1: '.$g1.' ';
for($k=0;$k<=13;$k++){
if($g1==$SUFF1[$k])echo ' | Perfect '.$SUFF1_T[$k].''.$GENDER[$k].' '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF2[$k])echo ' | Imperfect ['.$k.']: '.$SUFF2_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF3[$k])echo ' | Subjunctive Imperfect ['.$k.']: '.$SUFF3_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF4[$k])echo ' | Jussive Imperfect ['.$k.']: '.$SUFF4_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF5[$k])echo ' | Emphatic I Imperfect ['.$k.']: '.$SUFF5_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1==$SUFF5[$k])echo ' | Emphatic II Imperfect ['.$k.']: '.$SUFF6_T[$k].''.$GENDER[$k].', '.$NUMBER[$k].', '.$SUBJ_PRO_TRANS[$k];
if($g1=='')echo ' | Jussive Tense ['.$k.']';
}
for($m=0;$m<=23;$m++){
if($g1==$DEC_SUFF[$m])echo ' | Noun ['.$m.']: '.$DEC_SUFF_T[$m].''.$DEC_STATUS[$m];
}
//echo '
Suffix2: '.$g2.' ';
for($d=0;$d<=13;$d++){
if($g2==$OBJ_PRO[$d])echo ' | Object Pronoun ['.$d.']: '.$OBJ_PRO_T[$d].''.$GENDER[$d].', '.$NUMBER[$d].', '.$OBJ_PRO_TRANS[$d];
if($g2==$GEN_PRO[$d])echo ' | Genetive Pronoun ['.$d.']: '.$GEN_PRO_T[$d].''.$GENDER[$d].', '.$NUMBER[$d].', '.$GEN_PRO_TRANS[$d];
}
return $remainingWord; // Return after finding the first match
}
}
}
// No match found
//echo "No suffix match found in the word '$word'.";
}
?>