算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
tagging-and-annotations【设计与创意】Routes Flair annotation, tokenization, splitting, prediction-label inspection, serialization, regex tagging, and HTML visualization tasks for CPU-first package workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task is about creating or inspecting Flair Sentence objects, token/span/relation labels, pretrained prediction outputs, tokenization, sentence splitting, regex tagging, serialization, or simple HTML visualization in a pip-installed flair workflow.
Sentence, Token, Span, Relation, Label, or DataPair objects and attaching labels to the correct layer.Classifier.load(...), SequenceTagger.load(...), or TextClassifier.load(...), then reading predictions from get_labels(...), get_spans(...), or get_relations(...).SegtokTokenizer, SpaceTokenizer, NoTokenizer, SpacyTokenizer, SciSpacyTokenizer, JapaneseTokenizer, StaccatoTokenizer, or sentence splitters.RegexpTagger for no-download rule-based span labels.Sentence.to_dict() / Sentence.from_dict() or rendering NER-style HTML with render_ner_html(...).Use the training-and-datasets sub-skill instead for corpus readers, label dictionaries for training, ModelTrainer, fine-tuning, TARS, or multi-GPU launch. Use the embeddings-and-optimization sub-skill for embedding selection, vector shapes, ONNX/provider runtimes, TorchScript, or cache-heavy embedding optimization. Use the biomedical-nlp sub-skill for HunFlair/HunFlair2 entity linking, SciSpaCy-heavy biomedical workflows, abbreviations, or pyab3p-specific behavior.
FLAIR_DEVICE=cpu before importing flair.Classifier.load("ner"), SequenceTagger.load("ner"), and TextClassifier.load("sentiment") may download public resources.flair (for example a project-local cache) so future agents know where models went.python scripts/annotation_smoke.py --json
The script uses only local in-memory sentences, manual labels, rule-based tagging, tokenizers, splitters, serialization, and HTML rendering.
Sentence(text) for the default SegTok route, Sentence(text, use_tokenizer=False) for whitespace tokenization, Sentence(text, use_tokenizer=Tokenizer()) for a custom tokenizer, or Sentence(["pre", "tokenized"]) when token boundaries are already decided.add_label / set_label is the layer name such as "ner", "pos", "sentiment", or "relation"; the second argument is the class value such as "PER" or "POSITIVE".sentence.get_labels("ner") for Label objects, sentence.get_spans("ner") for span data points, and sentence.get_relations("relation") for relation data points. Calling get_labels() with no argument returns all layers and is a common source of mixed output.sentence.text; sentence.start_position records the sentence offset in a larger document.Sentence.from_dict(sentence.to_dict()) preserves sentence/span/relation labels and tokenizer configuration when the tokenizer class and optional dependencies are available.RegexpTagger, relations, DataPair, serialization, and HTML visualization.Classifier.load(model_id) in examples because it dispatches to the appropriate Flair classifier class. Use SequenceTagger.load(...) or TextClassifier.load(...) only when the task specifically needs that concrete class.label_name="new_layer" to prediction methods when preserving an existing layer matters; prediction normally removes existing labels in the target layer before adding new ones.Span objects by default; use force_token_predictions=True only when token-level outputs are required.RegexpTagger, regex match spans must align exactly with token boundaries. If a match cuts through a token, adjust tokenization or the regex before treating the output as valid.render_ner_html(..., label_name="layer") only for non-overlapping span-style labels that should be shown in one visual layer.flair package plus explicitly permitted optional resources, not the original source checkout.