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
6 changes: 6 additions & 0 deletions Help/markdown/Table_of_Special_Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(). |
Expand Down
6 changes: 6 additions & 0 deletions Help/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
47 changes: 47 additions & 0 deletions Help/markdown/isarray.md
Original file line number Diff line number Diff line change
@@ -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)
47 changes: 47 additions & 0 deletions Help/markdown/iscon.md
Original file line number Diff line number Diff line change
@@ -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)
46 changes: 46 additions & 0 deletions Help/markdown/isfloat.md
Original file line number Diff line number Diff line change
@@ -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)
46 changes: 46 additions & 0 deletions Help/markdown/isnum.md
Original file line number Diff line number Diff line change
@@ -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)
47 changes: 47 additions & 0 deletions Help/markdown/ispn.md
Original file line number Diff line number Diff line change
@@ -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)
46 changes: 46 additions & 0 deletions Help/markdown/isstr.md
Original file line number Diff line number Diff line change
@@ -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)
Loading