Skip to content

Commit e77d989

Browse files
📝 update generated v1 md (#212)
1 parent d9a5c60 commit e77d989

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

docs/extras/guide/custom_v1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ A `ListField` is a special type of custom list that implements the following:
6060
Since the inner contents can vary, the value isn't accessed through a property, but rather through the following functions:
6161
* **contents_list()** (`-> List[Union[str, float]]`): returns a list of values for each element.
6262
* **contents_string(separator=" ")** (`-> str`): returns a list of concatenated values, with an optional **separator** `str` between them.
63-
* **__str__()**: returns a string representation of all values, with an empty space between each of them.
63+
> **Note:** the `str()` method returns a string representation of all values of this object, with an empty space between each of them.
6464
6565

6666
#### List Field Value
@@ -79,7 +79,7 @@ A `ClassificationField` is a special type of custom classification that implemen
7979

8080
* **value** (`str`): the value of the classification. Corresponds to one of the values specified during training.
8181
* **confidence** (`float`): the confidence score of the field prediction.
82-
* **__str__()**: returns a string representation of all values, with an empty space between each of them.
82+
> **Note:** the `str()` method returns a string representation of all values of this object, with an empty space between each of them.
8383
8484
# Attributes
8585

docs/extras/guide/generated_v1.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Generated API Python
33
---
4-
54
The Python OCR SDK supports generated APIs.
65
Generated APIs can theoretically support all APIs in a catch-all generic format.
76

@@ -61,23 +60,31 @@ Since the inner contents can vary, the value isn't accessed through a property,
6160

6261
- **contents_list()** (`-> List[Union[str, float]]`): returns a list of values for each element.
6362
- **contents_string(separator=" ")** (`-> str`): returns a list of concatenated values, with an optional **separator** `str` between them.
64-
- ****str**()**: returns a string representation of all values, appropriate spacing.
63+
> **Note:** the `str()` method returns a string representation of all values of this object, with an empty space between each of them.
6564
66-
#### Generated Object Field
65+
### Generated Object Field
6766

6867
Unrecognized structures and sometimes values of `ListField`s are stored in a `GeneratedObjectField` structure, which is implemented dynamically depending on the object's structure.
6968

70-
No matter what, the fields will be stored in a dictionary-like structure with a `key: value` pair where `key` is a string and `value` is a nullable string. The object also contains:
71-
7269
- **page_id** (`Optional[int]`): the ID of the page, is `None` when at document-level.
70+
- **raw_value** (`Optional[str]`): an optional field for when some post-processing has been done on fields (e.g. amounts). `None` in most instances.
71+
- **confidence** (`Optional[float]`): the confidence score of the field prediction. Warning: support isn't guaranteed on all APIs.
72+
73+
74+
> **Other fields**:No matter what, other fields will be stored in a dictionary-like structure with a `key: value` pair where `key` is a string and `value` is a nullable string. They can be accessed like any other regular value, but won't be suggested by your IDE.
75+
76+
77+
### StringField
78+
The text field `StringField` only has one constraint: its **value** is an `Optional[str]`.
79+
7380

7481
# Attributes
7582

7683
Generated builds always have access to at least two attributes:
7784

7885
## Fields
7986

80-
**fields** (`Dict[str`: `List[Union[`[GeneratedListField](#generated-list-field)[GeneratedObjectField](#generated-object-field), `StringField]]`):
87+
**fields** (`Dict[str`: `List[Union[`[GeneratedListField](#generated-list-field)[GeneratedObjectField](#generated-object-field), `(#stringfield)[StringField]]]`):
8188

8289
```python
8390
print(str(result.document.inference.prediction.fields["my-field"]))

0 commit comments

Comments
 (0)