diff --git a/Help/markdown/Table_of_Special_Functions.md b/Help/markdown/Table_of_Special_Functions.md index 3dd15f7..bac5c35 100644 --- a/Help/markdown/Table_of_Special_Functions.md +++ b/Help/markdown/Table_of_Special_Functions.md @@ -16,6 +16,12 @@ The return types include:  **STR** (string), **INT** (integer), and **BOOL** (B | [**findana**](findana.md) | **BOOL(1,0)** | See if named project is already resident in memory. **(New in 1.6)** | | [**hitconf(hits_num, total_num, fudge_num)**](hitconf.md) | **INT (0 to 100)** | Calculate the keyword density. Fudge factor is typically 3 to 20. | | [**interactive()**](interactive.md) | **BOOL(1,0)** | True if analyzer is being run in an interactive environment, e.g., inside VisualText. | +| [**isarray(value)**](isarray.md) | **BOOL(1,0)** | True if the value is an array (more than one element). **(New in 4.2.34)** | +| [**iscon(value)**](iscon.md) | **BOOL(1,0)** | True if the value is a knowledge base concept. **(New in 4.2.34)** | +| [**isfloat(value)**](isfloat.md) | **BOOL(1,0)** | True if the value is a floating-point number. **(New in 4.2.34)** | +| [**isnum(value)**](isnum.md) | **BOOL(1,0)** | True if the value is an integer. An unset variable reads as 0, so it is one. **(New in 4.2.34)** | +| [**ispn(value)**](ispn.md) | **BOOL(1,0)** | True if the value is a parse tree node. **(New in 4.2.34)** | +| [**isstr(value)**](isstr.md) | **BOOL(1,0)** | True if the value is a string, including "" and digit strings. **(New in 4.2.34)** | | [**mkdir(dir_str)**](mkdir.md) | **BOOL(1,0)** | Create a directory. Operating system-dependent. | | [**permuten(tot_num)**](permuten.md) | **INT ARR** | Permute integers 0 to (tot_num - 1) such that array element k will never be equal to k. | | [**succeed()**](succeed.md) | **NONE** | In CHECK Region and CODE Region, succeed without executing further code. See fail(). | diff --git a/Help/markdown/index.md b/Help/markdown/index.md index a7387f5..e1dc0be 100644 --- a/Help/markdown/index.md +++ b/Help/markdown/index.md @@ -446,6 +446,12 @@ to a topic. - [findana](findana.md) - [hitconf](hitconf.md) - [interactive](interactive.md) + - [isarray](isarray.md) + - [iscon](iscon.md) + - [isfloat](isfloat.md) + - [isnum](isnum.md) + - [ispn](ispn.md) + - [isstr](isstr.md) - [mkdir](mkdir.md) - [permuten](permuten.md) - [sortconsbyattr](sortconsbyattr.md) diff --git a/Help/markdown/isarray.md b/Help/markdown/isarray.md new file mode 100644 index 0000000..8300654 --- /dev/null +++ b/Help/markdown/isarray.md @@ -0,0 +1,47 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# isarray + +## Purpose + +Test whether a value is an array: a value with more than one element. + +## Syntax + +``` +returnedBool = isarray(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is an array: a value with more than one element; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **isarray** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. + +**NEW 4.2.34** + +## Example + +``` +@CODE + +L("a")[0] = "x"; +L("a")[1] = "y"; +"output.txt" << isarray(L("a")) << "\n"; # 1 + +@@CODE +``` + +## See Also + +[iscon](iscon.md), [isstr](isstr.md), [isnum](isnum.md), [isfloat](isfloat.md), [ispn](ispn.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md) diff --git a/Help/markdown/iscon.md b/Help/markdown/iscon.md new file mode 100644 index 0000000..3444860 --- /dev/null +++ b/Help/markdown/iscon.md @@ -0,0 +1,47 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# iscon + +## Purpose + +Test whether a value is a knowledge base concept. + +## Syntax + +``` +returnedBool = iscon(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is a knowledge base concept; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **iscon** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. + +**NEW 4.2.34** + +## Example + +``` +@CODE + +L("c") = findconcept(findroot(), "colors"); +if (!iscon(L("c"))) + L("c") = makeconcept(findroot(), "colors"); + +@@CODE +``` + +## See Also + +[isstr](isstr.md), [isnum](isnum.md), [isfloat](isfloat.md), [ispn](ispn.md), [isarray](isarray.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md) diff --git a/Help/markdown/isfloat.md b/Help/markdown/isfloat.md new file mode 100644 index 0000000..8a02502 --- /dev/null +++ b/Help/markdown/isfloat.md @@ -0,0 +1,46 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# isfloat + +## Purpose + +Test whether a value is a floating-point number. + +## Syntax + +``` +returnedBool = isfloat(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is a floating-point number; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **isfloat** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. + +**NEW 4.2.34** + +## Example + +``` +@CODE + +L("x") = 4.5; +"output.txt" << isfloat(L("x")) << "\n"; # 1 + +@@CODE +``` + +## See Also + +[iscon](iscon.md), [isstr](isstr.md), [isnum](isnum.md), [ispn](ispn.md), [isarray](isarray.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md) diff --git a/Help/markdown/isnum.md b/Help/markdown/isnum.md new file mode 100644 index 0000000..7f5b141 --- /dev/null +++ b/Help/markdown/isnum.md @@ -0,0 +1,46 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# isnum + +## Purpose + +Test whether a value is an integer. + +## Syntax + +``` +returnedBool = isnum(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is an integer; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **isnum** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. A variable that was never set reads as 0 in NLP++, so it counts as an integer. + +**NEW 4.2.34** + +## Example + +``` +@CODE + +if (isnum(N("count", 1)) && N("count", 1) > 2) + "output.txt" << "frequent\n"; + +@@CODE +``` + +## See Also + +[iscon](iscon.md), [isstr](isstr.md), [isfloat](isfloat.md), [ispn](ispn.md), [isarray](isarray.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md) diff --git a/Help/markdown/ispn.md b/Help/markdown/ispn.md new file mode 100644 index 0000000..4aeb8ba --- /dev/null +++ b/Help/markdown/ispn.md @@ -0,0 +1,47 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# ispn + +## Purpose + +Test whether a value is a parse tree node. + +## Syntax + +``` +returnedBool = ispn(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is a parse tree node; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **ispn** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. + +**NEW 4.2.34** + +## Example + +``` +@CODE + +L("n") = N("head", 1); +if (ispn(L("n"))) + "output.txt" << pnname(L("n")) << "\n"; + +@@CODE +``` + +## See Also + +[iscon](iscon.md), [isstr](isstr.md), [isnum](isnum.md), [isfloat](isfloat.md), [isarray](isarray.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md) diff --git a/Help/markdown/isstr.md b/Help/markdown/isstr.md new file mode 100644 index 0000000..77027fa --- /dev/null +++ b/Help/markdown/isstr.md @@ -0,0 +1,46 @@ +[← Help Contents](index.md) | [📘 NLP++ Textbook](NLP++_Textbook.md) + +# isstr + +## Purpose + +Test whether a value is a string. + +## Syntax + +``` +returnedBool = isstr(value) +``` + +``` +returnedBool - type: bool + +value - any value: a string, number, concept, parse tree node or array +``` + +## Returns + +1 if the value is a string; otherwise 0. + +## Remarks + +NLP++ is loosely typed, and a function given the wrong kind of value often fails without saying so. **isstr** and the other type tests let code check first. They accept any value and never print a warning, even for an empty one. Pass exactly one argument. A string of digits such as "42" is a string, and so is the empty string "". + +**NEW 4.2.34** + +## Example + +``` +@CODE + +if (isstr(N("lemma", 1))) + "lemmas.txt" << N("lemma", 1) << "\n"; + +@@CODE +``` + +## See Also + +[iscon](iscon.md), [isnum](isnum.md), [isfloat](isfloat.md), [ispn](ispn.md), [isarray](isarray.md), [pnvartype](pnvartype.md) + +[Special Functions](Table_of_Special_Functions.md)