Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse without starting H #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions MorphParse/MorphParse.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ var MorphParse = function()
* @param {string} code A morph code
* @returns (string} The morphology
*/
this.Parse = function(code)
this.Parse = function(code1)
{
language = code.charAt(0);
code = code.substr(1);
language = code1.charAt(0);
code = code1.substr(1);
var parts = code.split('/');
var morph = parseCode(parts[0]);
if (!morph) { // Not starting with language character H/A
code = code1;
parts = code.split('/');
morph = parseCode(parts[0]);
if (!morph)
return 'Unknown part of speech in ' + code
}
for (var i = 1; i < parts.length; i++) {
morph += ', ' + parseCode(parts[i]);
}
Expand Down Expand Up @@ -52,7 +59,7 @@ var MorphParse = function()
morph += ' ' + parseVerb(code);
break;
default:
morph += ' Unknown part of speech in ' + code;
return false;
}
}
return morph;
Expand Down