infer
Classify text into semantic types with finetype infer: a single value, a file of values, or a stream of column batches. Its usage, options and output formats.
Classify text into one of Finetype's 251 semantic types. Use infer to explore individual values, process files of inputs, or stream column batches via JSONL.
infer runs the shipped model, which predicts 244 of the taxonomy's 251 types directly. The other 7 are taxonomy-live but not model-predicted — infer will not return them; only finetype profile's column-level guards recover them. See the type registry for the full taxonomy and how the two counts relate.
Usage
finetype infer [OPTIONS]Options
| Flag | Type | Default | Description |
|---|---|---|---|
-i, --input | string | — | Single text input |
-f, --file | path | — | File containing inputs (one per line) |
-o, --output | string | plain | Output format: plain, json or csv. --help also lists markdown, arrow, json-schema and datapackage, but on infer v0.6.67 prints the plain output for each |
--confidence | flag | — | Include confidence score |
-v, --value | flag | — | Include input value in output; v0.6.67 does not yet print it in plain, json or csv output |
--mode | string | column | Inference mode: column treats all inputs as one column and uses their distribution to disambiguate; row is unsupported, because the shipped model is column-level |
--sample-size | integer | 100 | Sample size for column mode |
--header | string | — | Column name for header hint |
--batch | flag | — | Read JSONL from stdin, one {"header":"col_name","values":["v1","v2",...]} per line, and write one JSON line per input with its classification |
--explain | flag | — | Diagnostic cascade: given a column's predicted type and samples, return the inferred correct type and a mechanism token explaining the predicted/actual relationship. Requires --batch; stdin is NDJSON of {"column_name","predicted_type","samples":[...]} |
--taxonomy | path | labels | Taxonomy file or directory (used with --explain) |
Examples
These examples use values from contacts.csv, the quick start's sample file.
Classify a single value
The label prints first, with the confidence and sample count beneath it:
finetype infer -i "alice@example.com" --confidenceidentity.person.email
confidence: 0.9900 (1 samples)
disambiguation: deterministic_fast_pathdeterministic_fast_path means the value's structure settled the type without the model, and the confidence is then a fixed 0.99. It applies to a narrow set of types, among them email addresses, IPv4 addresses and delimited ISO 8601 timestamps, and only when no --header is given. Other values go to the model:
finetype infer -i "not-an-email" --confidencerepresentation.text.entity_name
confidence: 0.4900 (1 samples)A single value carries less signal than a full column. For anything beyond a quick check, reach for profile.
Classify a column from a file
A file of values, one per line, is treated as a single column and resolved to one type. This writes the email column of contacts.csv to a file and classifies it with its column name as the header hint:
tail -n +2 contacts.csv | cut -d, -f3 > emails.txt
finetype infer -f emails.txt --header "email" --confidenceidentity.person.email
confidence: 0.6383 (12 samples)With --header the model classifies the column, as profile does, and reads it at the same confidence. Without --header, 11 of the 12 values pass the email check, which is enough for the structural path:
finetype infer -f emails.txt --confidenceidentity.person.email
confidence: 0.9900 (12 samples)
disambiguation: deterministic_fast_pathClassify a stream of columns
--batch reads one column per JSONL line from stdin and writes one JSON line per column. Progress lines go to stderr:
printf '%s\n' \
'{"header":"email","values":["alice@example.com","bob@company.org","not-an-email"]}' \
'{"header":"created_at","values":["2024-01-15T09:30:00Z","2024-02-20T14:15:00Z"]}' \
| finetype infer --batch{"confidence":0.7841140627861023,"disambiguation_rule":"header_hint_cross_domain:email","label":"identity.person.email","samples_used":3}
{"confidence":0.9971720576286316,"label":"datetime.timestamp.iso_8601","samples_used":2}Row mode
The shipped model is column-level, so --mode row stops with an error:
finetype infer -i "alice@example.com" --mode rowError: Row mode is unsupported: the shipped model is column-level. Use --mode column (the default) or `finetype profile`.To profile a whole CSV in one step, every column at once, use profile.
Output formats
-o json emits the full classification, including the vote distribution and which disambiguation rule fired. The vote distribution is empty when the structural path settled the type:
finetype infer -i "alice@example.com" -o json --confidence{
"confidence": 0.9900000095367432,
"disambiguation_applied": true,
"disambiguation_rule": "deterministic_fast_path",
"label": "identity.person.email",
"samples_used": 1,
"vote_distribution": []
}-o csv gives a compact label,confidence,samples row, handy for piping:
finetype infer -i "alice@example.com" -o csv --confidenceidentity.person.email,0.9900,1See also
profile— profile an entire CSV file using column-mode inferencetaxonomy— browse the semantic type taxonomy- Type Registry — browse all 251 semantic types
CLI Reference
Complete reference for every Finetype command, with flags, defaults and examples, how the commands make a pipeline, and the output formats they write.
profile
Profile a CSV, Parquet, JSON or NDJSON file with finetype profile, detecting the semantic type of every column, then export a JSON Schema or a Data Package.