Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions tutorial-02/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-03/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-06/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-08/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-11/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-13/tutorial-13-b/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down
11 changes: 6 additions & 5 deletions tutorial-15/spec/KBFuncs.nlp
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ CountName(L("con"),L("root")) {
}

StripEndDigits(L("name")) {
# "item12" -> "item". A name with no trailing digits comes back whole,
# an all-digit name gives 0. Positions only count up from 0, so a short
# name never reaches a negative strpiece position (which counts from the
# end since engine 4.2.15).
if (strisdigit(L("name"))) return 0;
L("len") = strlength(L("name")) - 1;
L("i") = L("len") - 1;
L("str") = strpiece(L("name"),L("i"),L("len"));
while (strisdigit(L("str")) && L("i")) {
L("i") = strlength(L("name")) - 1;
while (L("i") > 0 && strisdigit(strpiece(L("name"),L("i"),L("i")))) {
L("i")--;
L("str") = strpiece(L("name"),L("i"),L("len"));
}
return strpiece(L("name"),0,L("i"));
}
Expand Down