glazing.cli.search¶
Search command implementation.
search
¶
CLI commands for searching across linguistic datasets.
This module provides commands for searching and querying converted datasets in JSON Lines format.
Commands
search query Search across datasets with a text query. search entity Get details about a specific entity. search role Search for semantic roles across datasets. search cross-ref Find cross-references between datasets.
| FUNCTION | DESCRIPTION |
|---|---|
find_cross_ref |
Find cross-references between datasets. |
get_entity |
Get details about a specific entity. |
load_search_index |
Load search index from converted JSON Lines files. |
search |
Query linguistic datasets from the command line. |
search_args |
Search for arguments with specific properties. |
search_elements |
Search for frame elements with specific properties. |
search_fuzzy |
Search with fuzzy matching and typo correction. |
search_query |
Search across datasets with a text query. |
search_relations |
Search for synsets with specific relations. |
search_role |
Search for semantic roles across datasets. |
search_roles |
Search for semantic roles with specific properties. |
search_syntax |
Search for syntactic patterns with morphological features. |
Classes¶
Functions¶
find_cross_ref(source: str, target: str, entity_id: str, data_dir: str | Path) -> None
¶
Find cross-references between datasets.
Examples:
Find PropBank references for VerbNet class: $ glazing search cross-ref --source verbnet --target propbank --id "give-13.1" --data-dir output/
Find VerbNet references for PropBank roleset: $ glazing search cross-ref --source propbank --target verbnet --id "give.01" --data-dir output/
Source code in src/glazing/cli/search.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
get_entity(entity_id: str, dataset: str, data_dir: str | Path, output_json: bool) -> None
¶
Get details about a specific entity.
Examples:
Get VerbNet class details: $ glazing search entity "give-13.1" --dataset verbnet --data-dir output/
Get PropBank roleset details: $ glazing search entity "give.01" --dataset propbank --data-dir output/
Source code in src/glazing/cli/search.py
load_search_index(data_dir: str | Path, datasets: list[str] | None = None) -> UnifiedSearch
¶
Load search index from converted JSON Lines files.
| PARAMETER | DESCRIPTION |
|---|---|
data_dir
|
Directory containing converted JSON Lines files.
TYPE:
|
datasets
|
List of datasets to load, or None for all.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UnifiedSearch
|
Initialized search object. |
Source code in src/glazing/cli/search.py
search() -> None
¶
search_args(data_dir: str | Path, arg_type: str | None, prefix: str | None, modifier: str | None, number: int | None, dataset: str) -> None
¶
Search for arguments with specific properties.
Examples:
Find core arguments: $ glazing search args --type core
Find location modifiers: $ glazing search args --modifier LOC
Find continuation arguments: $ glazing search args --prefix C
Source code in src/glazing/cli/search.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | |
search_elements(data_dir: str | Path, core_type: str | None, dataset: str) -> None
¶
Search for frame elements with specific properties.
Examples:
Find core elements: $ glazing search elements --core-type Core
Find non-core elements: $ glazing search elements --core-type Non-Core
Source code in src/glazing/cli/search.py
search_fuzzy(query_text: str, data_dir: str | Path, threshold: float, limit: int) -> None
¶
Search with fuzzy matching and typo correction.
Examples:
Search with typo correction: $ glazing search fuzzy "instsrument" --threshold 0.7
Source code in src/glazing/cli/search.py
search_query(query_text: str, data_dir: str | Path, dataset: DatasetName, limit: int, fuzzy: bool, threshold: float, output_json: bool) -> None
¶
Search across datasets with a text query.
Examples:
Search all datasets: $ glazing search query "give" --data-dir output/
Search only VerbNet: $ glazing search query "transfer" --data-dir output/ --dataset verbnet
Source code in src/glazing/cli/search.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
search_relations(data_dir: str | Path, relation_type: str, dataset: str) -> None
¶
Search for synsets with specific relations.
Examples:
Find hypernyms: $ glazing search relations --type hypernym
Find antonyms: $ glazing search relations --type antonym
Source code in src/glazing/cli/search.py
search_role(role_name: str, data_dir: str | Path, dataset: str) -> None
¶
Search for semantic roles across datasets.
Examples:
Search for Agent role: $ glazing search role "Agent" --data-dir output/
Search for ARG0 in PropBank: $ glazing search role "ARG0" --data-dir output/ --dataset propbank
Source code in src/glazing/cli/search.py
search_roles(data_dir: str | Path, optional: bool, indexed: bool, verb_specific: bool, dataset: str) -> None
¶
Search for semantic roles with specific properties.
Examples:
Find optional roles: $ glazing search roles --optional
Find indexed roles: $ glazing search roles --indexed
Source code in src/glazing/cli/search.py
search_syntax(pattern: str, data_dir: str | Path, dataset: str, limit: int) -> None
¶
Search for syntactic patterns with morphological features.
Supports hierarchical matching and morphological features. General patterns match specific ones (e.g., "NP V PP" matches "NP V PP.instrument").
Examples:
Find all patterns with NP V PP: $ glazing search syntax "NP V PP"
Find patterns with specific PP type: $ glazing search syntax "NP V PP.instrument"
Find patterns with specific preposition: $ glazing search syntax "NP V PP[with]"
Find patterns with morphological features: $ glazing search syntax "NP V[ING] NP"
Find patterns with wildcards: $ glazing search syntax "NP V NP *"
Source code in src/glazing/cli/search.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | |