Skip to content

docs: add examples to Language.__call__ and pipe() methods#13945

Open
mokshagnachintha wants to merge 1 commit intoexplosion:masterfrom
mokshagnachintha:docs/enhance-pipe-examples
Open

docs: add examples to Language.__call__ and pipe() methods#13945
mokshagnachintha wants to merge 1 commit intoexplosion:masterfrom
mokshagnachintha:docs/enhance-pipe-examples

Conversation

@mokshagnachintha
Copy link
Copy Markdown

Summary

This PR enhances the documentation of two core Language class methods with comprehensive, practical examples to improve discoverability and reduce the learning curve for new spaCy users.

Changes

Enhanced Language.call() docstring with 5 usage examples:

  • Basic single text processing
  • Multi-sentence text handling
  • Named entity extraction and iteration
  • Disabling single component for performance
  • Disabling multiple components

Enhanced Language.pipe() docstring with 6 usage examples:

  • Batch text processing from lists
  • Context handling with as_tuples parameter
  • Custom batch size optimization
  • Component disabling for pipeline efficiency
  • Multiprocessing for large-scale processing

Why This Matters

  • Better Documentation: Examples follow spaCy's existing doctest format
  • Faster Learning: New users understand common usage patterns immediately
  • Reduced Support: Clear examples answer FAQ about batch processing and performance tips
  • Consistency: Examples align with spaCy's documentation standards

Type of Change

  • Documentation improvement
  • Bug fix
  • New feature
  • Breaking change

Testing

  • Documentation examples follow doctest format
  • Examples are runnable pseudocode based on spaCy API
  • No behavior changes - purely documentation

Checklist

  • My documentation additions follow spaCy style guide
  • Examples are practical and realistic
  • Code examples are properly formatted with correct indentation
  • I've verified examples align with current spaCy API
  • No files changed except documentation strings

- Add comprehensive examples to __call__ method showing basic usage,
  multi-sentence processing, named entity extraction, and disabling components
- Add detailed examples to pipe() method demonstrating batch processing,
  context handling with as_tuples, batch_size optimization, component
  disabling, and multiprocessing usage
- Examples follow spaCy documentation style with doctest format
- Improves discoverability of core API features for new users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant