-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_usage.py
More file actions
32 lines (24 loc) · 988 Bytes
/
Copy pathbasic_usage.py
File metadata and controls
32 lines (24 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Basic end-to-end usage example for paralabelgen."""
from labelgen import LabelGenerator, LabelGeneratorConfig
def main() -> None:
"""Run a minimal fit-transform workflow with the default pipeline."""
paragraphs = [
"OpenAI builds language models for developers.",
"Developers use language models in production systems.",
"Production systems need monitoring, evaluation, and deployment tooling.",
]
generator = LabelGenerator(LabelGeneratorConfig())
result = generator.fit_transform(paragraphs)
print("Concepts:")
for concept in result.concepts:
print(
f"- {concept.normalized} | kind={concept.kind} | "
f"document_frequency={concept.document_frequency}"
)
print("\nParagraph Labels:")
for labels in result.paragraph_labels:
print(
f"- {labels.paragraph_id}: {labels.label_ids} | scores={labels.label_scores}"
)
if __name__ == "__main__":
main()