fast-sentence-segment 1.2.0__tar.gz → 1.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/PKG-INFO +55 -17
  2. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/README.md +54 -16
  3. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/pyproject.toml +1 -1
  4. fast_sentence_segment-1.2.1/setup.py +38 -0
  5. fast_sentence_segment-1.2.0/setup.py +0 -38
  6. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/LICENSE +0 -0
  7. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/__init__.py +0 -0
  8. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/bp/__init__.py +0 -0
  9. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/bp/segmenter.py +0 -0
  10. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/cli.py +0 -0
  11. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/core/__init__.py +0 -0
  12. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/core/base_object.py +0 -0
  13. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/core/stopwatch.py +0 -0
  14. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/__init__.py +0 -0
  15. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/abbreviation_merger.py +0 -0
  16. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/abbreviation_splitter.py +0 -0
  17. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/abbreviations.py +0 -0
  18. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/bullet_point_cleaner.py +0 -0
  19. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/ellipsis_normalizer.py +0 -0
  20. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/newlines_to_periods.py +0 -0
  21. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/numbered_list_normalizer.py +0 -0
  22. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/post_process_sentences.py +0 -0
  23. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/question_exclamation_splitter.py +0 -0
  24. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/spacy_doc_segmenter.py +0 -0
  25. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/dmo/title_name_merger.py +0 -0
  26. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/svc/__init__.py +0 -0
  27. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/svc/perform_paragraph_segmentation.py +0 -0
  28. {fast_sentence_segment-1.2.0 → fast_sentence_segment-1.2.1}/fast_sentence_segment/svc/perform_sentence_segmentation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-sentence-segment
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Fast and Efficient Sentence Segmentation
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -67,12 +67,21 @@ python -m spacy download en_core_web_sm
67
67
  ```python
68
68
  from fast_sentence_segment import segment_text
69
69
 
70
- text = "Here is a Dr. who says something. And then again, what else? I don't know. Do you?"
70
+ text = "Do you like Dr. Who? I prefer Dr. Strange! Mr. T is also cool."
71
71
 
72
- results = segment_text(text)
73
- # Returns: [['Here is a Dr. who says something.', 'And then again, what else?', "I don't know.", 'Do you?']]
72
+ results = segment_text(text, flatten=True)
74
73
  ```
75
74
 
75
+ ```json
76
+ [
77
+ "Do you like Dr. Who?",
78
+ "I prefer Dr. Strange!",
79
+ "Mr. T is also cool."
80
+ ]
81
+ ```
82
+
83
+ Notice how "Dr. Who?" stays together as a single sentence—the library correctly recognizes that a title followed by a single-word name ending in `?` or `!` is a name reference, not a sentence boundary.
84
+
76
85
  ## Usage
77
86
 
78
87
  ### Basic Segmentation
@@ -82,16 +91,24 @@ The `segment_text` function returns a list of lists, where each inner list repre
82
91
  ```python
83
92
  from fast_sentence_segment import segment_text
84
93
 
85
- text = """First paragraph here. It has two sentences.
94
+ text = """Gandalf spoke softly. "All we have to decide is what to do with the time given us."
86
95
 
87
- Second paragraph starts here. This one also has multiple sentences. And a third."""
96
+ Frodo nodded. The weight of the Ring pressed against his chest."""
88
97
 
89
98
  results = segment_text(text)
90
- # Returns:
91
- # [
92
- # ['First paragraph here.', 'It has two sentences.'],
93
- # ['Second paragraph starts here.', 'This one also has multiple sentences.', 'And a third.']
94
- # ]
99
+ ```
100
+
101
+ ```json
102
+ [
103
+ [
104
+ "Gandalf spoke softly.",
105
+ "\"All we have to decide is what to do with the time given us.\"."
106
+ ],
107
+ [
108
+ "Frodo nodded.",
109
+ "The weight of the Ring pressed against his chest."
110
+ ]
111
+ ]
95
112
  ```
96
113
 
97
114
  ### Flattened Output
@@ -99,8 +116,17 @@ results = segment_text(text)
99
116
  If you don't need paragraph boundaries, use the `flatten` parameter:
100
117
 
101
118
  ```python
119
+ text = "At 9 a.m. the hobbits set out. By 3 p.m. they reached Rivendell. Mr. Frodo was exhausted."
120
+
102
121
  results = segment_text(text, flatten=True)
103
- # Returns: ['First paragraph here.', 'It has two sentences.', 'Second paragraph starts here.', ...]
122
+ ```
123
+
124
+ ```json
125
+ [
126
+ "At 9 a.m. the hobbits set out.",
127
+ "By 3 p.m. they reached Rivendell.",
128
+ "Mr. Frodo was exhausted."
129
+ ]
104
130
  ```
105
131
 
106
132
  ### Direct Segmenter Access
@@ -120,16 +146,28 @@ Segment text directly from the terminal:
120
146
 
121
147
  ```bash
122
148
  # Direct text input
123
- segment "Hello world. How are you? I am fine."
149
+ echo "Have you seen Dr. Who? It's brilliant!" | segment
150
+ ```
124
151
 
152
+ ```
153
+ Have you seen Dr. Who?
154
+ It's brilliant!
155
+ ```
156
+
157
+ ```bash
125
158
  # Numbered output
126
- segment -n "First sentence. Second sentence."
159
+ segment -n "Gandalf paused... You shall not pass! The Balrog roared."
160
+ ```
127
161
 
128
- # From stdin
129
- echo "Some text here. Another sentence." | segment
162
+ ```
163
+ 1. Gandalf paused...
164
+ 2. You shall not pass!
165
+ 3. The Balrog roared.
166
+ ```
130
167
 
168
+ ```bash
131
169
  # From file
132
- segment -f document.txt
170
+ segment -f silmarillion.txt
133
171
  ```
134
172
 
135
173
  ## API Reference
@@ -40,12 +40,21 @@ python -m spacy download en_core_web_sm
40
40
  ```python
41
41
  from fast_sentence_segment import segment_text
42
42
 
43
- text = "Here is a Dr. who says something. And then again, what else? I don't know. Do you?"
43
+ text = "Do you like Dr. Who? I prefer Dr. Strange! Mr. T is also cool."
44
44
 
45
- results = segment_text(text)
46
- # Returns: [['Here is a Dr. who says something.', 'And then again, what else?', "I don't know.", 'Do you?']]
45
+ results = segment_text(text, flatten=True)
47
46
  ```
48
47
 
48
+ ```json
49
+ [
50
+ "Do you like Dr. Who?",
51
+ "I prefer Dr. Strange!",
52
+ "Mr. T is also cool."
53
+ ]
54
+ ```
55
+
56
+ Notice how "Dr. Who?" stays together as a single sentence—the library correctly recognizes that a title followed by a single-word name ending in `?` or `!` is a name reference, not a sentence boundary.
57
+
49
58
  ## Usage
50
59
 
51
60
  ### Basic Segmentation
@@ -55,16 +64,24 @@ The `segment_text` function returns a list of lists, where each inner list repre
55
64
  ```python
56
65
  from fast_sentence_segment import segment_text
57
66
 
58
- text = """First paragraph here. It has two sentences.
67
+ text = """Gandalf spoke softly. "All we have to decide is what to do with the time given us."
59
68
 
60
- Second paragraph starts here. This one also has multiple sentences. And a third."""
69
+ Frodo nodded. The weight of the Ring pressed against his chest."""
61
70
 
62
71
  results = segment_text(text)
63
- # Returns:
64
- # [
65
- # ['First paragraph here.', 'It has two sentences.'],
66
- # ['Second paragraph starts here.', 'This one also has multiple sentences.', 'And a third.']
67
- # ]
72
+ ```
73
+
74
+ ```json
75
+ [
76
+ [
77
+ "Gandalf spoke softly.",
78
+ "\"All we have to decide is what to do with the time given us.\"."
79
+ ],
80
+ [
81
+ "Frodo nodded.",
82
+ "The weight of the Ring pressed against his chest."
83
+ ]
84
+ ]
68
85
  ```
69
86
 
70
87
  ### Flattened Output
@@ -72,8 +89,17 @@ results = segment_text(text)
72
89
  If you don't need paragraph boundaries, use the `flatten` parameter:
73
90
 
74
91
  ```python
92
+ text = "At 9 a.m. the hobbits set out. By 3 p.m. they reached Rivendell. Mr. Frodo was exhausted."
93
+
75
94
  results = segment_text(text, flatten=True)
76
- # Returns: ['First paragraph here.', 'It has two sentences.', 'Second paragraph starts here.', ...]
95
+ ```
96
+
97
+ ```json
98
+ [
99
+ "At 9 a.m. the hobbits set out.",
100
+ "By 3 p.m. they reached Rivendell.",
101
+ "Mr. Frodo was exhausted."
102
+ ]
77
103
  ```
78
104
 
79
105
  ### Direct Segmenter Access
@@ -93,16 +119,28 @@ Segment text directly from the terminal:
93
119
 
94
120
  ```bash
95
121
  # Direct text input
96
- segment "Hello world. How are you? I am fine."
122
+ echo "Have you seen Dr. Who? It's brilliant!" | segment
123
+ ```
97
124
 
125
+ ```
126
+ Have you seen Dr. Who?
127
+ It's brilliant!
128
+ ```
129
+
130
+ ```bash
98
131
  # Numbered output
99
- segment -n "First sentence. Second sentence."
132
+ segment -n "Gandalf paused... You shall not pass! The Balrog roared."
133
+ ```
100
134
 
101
- # From stdin
102
- echo "Some text here. Another sentence." | segment
135
+ ```
136
+ 1. Gandalf paused...
137
+ 2. You shall not pass!
138
+ 3. The Balrog roared.
139
+ ```
103
140
 
141
+ ```bash
104
142
  # From file
105
- segment -f document.txt
143
+ segment -f silmarillion.txt
106
144
  ```
107
145
 
108
146
  ## API Reference
@@ -11,7 +11,7 @@ description = "Fast and Efficient Sentence Segmentation"
11
11
  license = "MIT"
12
12
  name = "fast-sentence-segment"
13
13
  readme = "README.md"
14
- version = "1.2.0"
14
+ version = "1.2.1"
15
15
 
16
16
  keywords = ["nlp", "text", "preprocess", "segment"]
17
17
  repository = "https://github.com/craigtrim/fast-sentence-segment"
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ from setuptools import setup
3
+
4
+ packages = \
5
+ ['fast_sentence_segment',
6
+ 'fast_sentence_segment.bp',
7
+ 'fast_sentence_segment.core',
8
+ 'fast_sentence_segment.dmo',
9
+ 'fast_sentence_segment.svc']
10
+
11
+ package_data = \
12
+ {'': ['*']}
13
+
14
+ install_requires = \
15
+ ['spacy>=3.8.0,<4.0.0']
16
+
17
+ entry_points = \
18
+ {'console_scripts': ['segment = fast_sentence_segment.cli:main']}
19
+
20
+ setup_kwargs = {
21
+ 'name': 'fast-sentence-segment',
22
+ 'version': '1.2.1',
23
+ 'description': 'Fast and Efficient Sentence Segmentation',
24
+ 'long_description': '# Fast Sentence Segmentation\n\n[![PyPI version](https://img.shields.io/pypi/v/fast-sentence-segment.svg)](https://pypi.org/project/fast-sentence-segment/)\n[![Python versions](https://img.shields.io/pypi/pyversions/fast-sentence-segment.svg)](https://pypi.org/project/fast-sentence-segment/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![spaCy](https://img.shields.io/badge/spaCy-3.8-blue.svg)](https://spacy.io/)\n\nFast and efficient sentence segmentation using spaCy with surgical post-processing fixes. Handles complex edge cases like abbreviations (Dr., Mr., etc.), ellipses, quoted text, and multi-paragraph documents.\n\n## Why This Library?\n\n1. **Keep it local**: LLM API calls cost money and send your data to third parties. Run sentence segmentation entirely on your machine.\n2. **spaCy perfected**: spaCy is a great local model, but it makes mistakes. This library fixes most of spaCy\'s shortcomings.\n\n## Features\n\n- **Paragraph-aware segmentation**: Returns sentences grouped by paragraph\n- **Abbreviation handling**: Correctly handles "Dr.", "Mr.", "etc.", "p.m.", "a.m." without false splits\n- **Ellipsis preservation**: Keeps `...` intact while detecting sentence boundaries\n- **Question/exclamation splitting**: Properly splits on `?` and `!` followed by capital letters\n- **Cached processing**: LRU cache for repeated text processing\n- **Flexible output**: Nested lists (by paragraph) or flattened list of sentences\n- **Bullet point & numbered list normalization**: Cleans common list formats\n- **CLI tool**: Command-line interface for quick segmentation\n\n## Installation\n\n```bash\npip install fast-sentence-segment\n```\n\nAfter installation, download the spaCy model:\n\n```bash\npython -m spacy download en_core_web_sm\n```\n\n## Quick Start\n\n```python\nfrom fast_sentence_segment import segment_text\n\ntext = "Do you like Dr. Who? I prefer Dr. Strange! Mr. T is also cool."\n\nresults = segment_text(text, flatten=True)\n```\n\n```json\n[\n "Do you like Dr. Who?",\n "I prefer Dr. Strange!",\n "Mr. T is also cool."\n]\n```\n\nNotice how "Dr. Who?" stays together as a single sentence—the library correctly recognizes that a title followed by a single-word name ending in `?` or `!` is a name reference, not a sentence boundary.\n\n## Usage\n\n### Basic Segmentation\n\nThe `segment_text` function returns a list of lists, where each inner list represents a paragraph containing its sentences:\n\n```python\nfrom fast_sentence_segment import segment_text\n\ntext = """Gandalf spoke softly. "All we have to decide is what to do with the time given us."\n\nFrodo nodded. The weight of the Ring pressed against his chest."""\n\nresults = segment_text(text)\n```\n\n```json\n[\n [\n "Gandalf spoke softly.",\n "\\"All we have to decide is what to do with the time given us.\\"."\n ],\n [\n "Frodo nodded.",\n "The weight of the Ring pressed against his chest."\n ]\n]\n```\n\n### Flattened Output\n\nIf you don\'t need paragraph boundaries, use the `flatten` parameter:\n\n```python\ntext = "At 9 a.m. the hobbits set out. By 3 p.m. they reached Rivendell. Mr. Frodo was exhausted."\n\nresults = segment_text(text, flatten=True)\n```\n\n```json\n[\n "At 9 a.m. the hobbits set out.",\n "By 3 p.m. they reached Rivendell.",\n "Mr. Frodo was exhausted."\n]\n```\n\n### Direct Segmenter Access\n\nFor more control, use the `Segmenter` class directly:\n\n```python\nfrom fast_sentence_segment import Segmenter\n\nsegmenter = Segmenter()\nresults = segmenter.input_text("Your text here.")\n```\n\n### Command Line Interface\n\nSegment text directly from the terminal:\n\n```bash\n# Direct text input\necho "Have you seen Dr. Who? It\'s brilliant!" | segment\n```\n\n```\nHave you seen Dr. Who?\nIt\'s brilliant!\n```\n\n```bash\n# Numbered output\nsegment -n "Gandalf paused... You shall not pass! The Balrog roared."\n```\n\n```\n1. Gandalf paused...\n2. You shall not pass!\n3. The Balrog roared.\n```\n\n```bash\n# From file\nsegment -f silmarillion.txt\n```\n\n## API Reference\n\n| Function | Parameters | Returns | Description |\n|----------|------------|---------|-------------|\n| `segment_text()` | `input_text: str`, `flatten: bool = False` | `list` | Main entry point for segmentation |\n| `Segmenter.input_text()` | `input_text: str` | `list[list[str]]` | Cached paragraph-aware segmentation |\n\n### CLI Options\n\n| Option | Description |\n|--------|-------------|\n| `text` | Text to segment (positional argument) |\n| `-f, --file` | Read text from file |\n| `-n, --numbered` | Number output lines |\n\n## Why Nested Lists?\n\nThe segmentation process preserves document structure by segmenting into both paragraphs and sentences. Each outer list represents a paragraph, and each inner list contains that paragraph\'s sentences. This is useful for:\n\n- Document structure analysis\n- Paragraph-level processing\n- Maintaining original text organization\n\nUse `flatten=True` when you only need sentences without paragraph context.\n\n## Requirements\n\n- Python 3.9+\n- spaCy 3.8+\n- en_core_web_sm spaCy model\n\n## How It Works\n\nThis library uses spaCy for initial sentence segmentation, then applies surgical post-processing fixes for cases where spaCy\'s default behavior is incorrect:\n\n1. **Pre-processing**: Normalize numbered lists, preserve ellipses with placeholders\n2. **spaCy segmentation**: Use spaCy\'s sentence boundary detection\n3. **Post-processing**: Split on abbreviation boundaries, handle `?`/`!` + capital patterns\n4. **Denormalization**: Restore placeholders to original text\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Run tests (`make test`)\n4. Commit your changes\n5. Push to the branch\n6. Open a Pull Request\n',
25
+ 'author': 'Craig Trim',
26
+ 'author_email': 'craigtrim@gmail.com',
27
+ 'maintainer': 'Craig Trim',
28
+ 'maintainer_email': 'craigtrim@gmail.com',
29
+ 'url': 'https://github.com/craigtrim/fast-sentence-segment',
30
+ 'packages': packages,
31
+ 'package_data': package_data,
32
+ 'install_requires': install_requires,
33
+ 'entry_points': entry_points,
34
+ 'python_requires': '>=3.9,<4.0',
35
+ }
36
+
37
+
38
+ setup(**setup_kwargs)
@@ -1,38 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['fast_sentence_segment',
6
- 'fast_sentence_segment.bp',
7
- 'fast_sentence_segment.core',
8
- 'fast_sentence_segment.dmo',
9
- 'fast_sentence_segment.svc']
10
-
11
- package_data = \
12
- {'': ['*']}
13
-
14
- install_requires = \
15
- ['spacy>=3.8.0,<4.0.0']
16
-
17
- entry_points = \
18
- {'console_scripts': ['segment = fast_sentence_segment.cli:main']}
19
-
20
- setup_kwargs = {
21
- 'name': 'fast-sentence-segment',
22
- 'version': '1.2.0',
23
- 'description': 'Fast and Efficient Sentence Segmentation',
24
- 'long_description': '# Fast Sentence Segmentation\n\n[![PyPI version](https://img.shields.io/pypi/v/fast-sentence-segment.svg)](https://pypi.org/project/fast-sentence-segment/)\n[![Python versions](https://img.shields.io/pypi/pyversions/fast-sentence-segment.svg)](https://pypi.org/project/fast-sentence-segment/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![spaCy](https://img.shields.io/badge/spaCy-3.8-blue.svg)](https://spacy.io/)\n\nFast and efficient sentence segmentation using spaCy with surgical post-processing fixes. Handles complex edge cases like abbreviations (Dr., Mr., etc.), ellipses, quoted text, and multi-paragraph documents.\n\n## Why This Library?\n\n1. **Keep it local**: LLM API calls cost money and send your data to third parties. Run sentence segmentation entirely on your machine.\n2. **spaCy perfected**: spaCy is a great local model, but it makes mistakes. This library fixes most of spaCy\'s shortcomings.\n\n## Features\n\n- **Paragraph-aware segmentation**: Returns sentences grouped by paragraph\n- **Abbreviation handling**: Correctly handles "Dr.", "Mr.", "etc.", "p.m.", "a.m." without false splits\n- **Ellipsis preservation**: Keeps `...` intact while detecting sentence boundaries\n- **Question/exclamation splitting**: Properly splits on `?` and `!` followed by capital letters\n- **Cached processing**: LRU cache for repeated text processing\n- **Flexible output**: Nested lists (by paragraph) or flattened list of sentences\n- **Bullet point & numbered list normalization**: Cleans common list formats\n- **CLI tool**: Command-line interface for quick segmentation\n\n## Installation\n\n```bash\npip install fast-sentence-segment\n```\n\nAfter installation, download the spaCy model:\n\n```bash\npython -m spacy download en_core_web_sm\n```\n\n## Quick Start\n\n```python\nfrom fast_sentence_segment import segment_text\n\ntext = "Here is a Dr. who says something. And then again, what else? I don\'t know. Do you?"\n\nresults = segment_text(text)\n# Returns: [[\'Here is a Dr. who says something.\', \'And then again, what else?\', "I don\'t know.", \'Do you?\']]\n```\n\n## Usage\n\n### Basic Segmentation\n\nThe `segment_text` function returns a list of lists, where each inner list represents a paragraph containing its sentences:\n\n```python\nfrom fast_sentence_segment import segment_text\n\ntext = """First paragraph here. It has two sentences.\n\nSecond paragraph starts here. This one also has multiple sentences. And a third."""\n\nresults = segment_text(text)\n# Returns:\n# [\n# [\'First paragraph here.\', \'It has two sentences.\'],\n# [\'Second paragraph starts here.\', \'This one also has multiple sentences.\', \'And a third.\']\n# ]\n```\n\n### Flattened Output\n\nIf you don\'t need paragraph boundaries, use the `flatten` parameter:\n\n```python\nresults = segment_text(text, flatten=True)\n# Returns: [\'First paragraph here.\', \'It has two sentences.\', \'Second paragraph starts here.\', ...]\n```\n\n### Direct Segmenter Access\n\nFor more control, use the `Segmenter` class directly:\n\n```python\nfrom fast_sentence_segment import Segmenter\n\nsegmenter = Segmenter()\nresults = segmenter.input_text("Your text here.")\n```\n\n### Command Line Interface\n\nSegment text directly from the terminal:\n\n```bash\n# Direct text input\nsegment "Hello world. How are you? I am fine."\n\n# Numbered output\nsegment -n "First sentence. Second sentence."\n\n# From stdin\necho "Some text here. Another sentence." | segment\n\n# From file\nsegment -f document.txt\n```\n\n## API Reference\n\n| Function | Parameters | Returns | Description |\n|----------|------------|---------|-------------|\n| `segment_text()` | `input_text: str`, `flatten: bool = False` | `list` | Main entry point for segmentation |\n| `Segmenter.input_text()` | `input_text: str` | `list[list[str]]` | Cached paragraph-aware segmentation |\n\n### CLI Options\n\n| Option | Description |\n|--------|-------------|\n| `text` | Text to segment (positional argument) |\n| `-f, --file` | Read text from file |\n| `-n, --numbered` | Number output lines |\n\n## Why Nested Lists?\n\nThe segmentation process preserves document structure by segmenting into both paragraphs and sentences. Each outer list represents a paragraph, and each inner list contains that paragraph\'s sentences. This is useful for:\n\n- Document structure analysis\n- Paragraph-level processing\n- Maintaining original text organization\n\nUse `flatten=True` when you only need sentences without paragraph context.\n\n## Requirements\n\n- Python 3.9+\n- spaCy 3.8+\n- en_core_web_sm spaCy model\n\n## How It Works\n\nThis library uses spaCy for initial sentence segmentation, then applies surgical post-processing fixes for cases where spaCy\'s default behavior is incorrect:\n\n1. **Pre-processing**: Normalize numbered lists, preserve ellipses with placeholders\n2. **spaCy segmentation**: Use spaCy\'s sentence boundary detection\n3. **Post-processing**: Split on abbreviation boundaries, handle `?`/`!` + capital patterns\n4. **Denormalization**: Restore placeholders to original text\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Run tests (`make test`)\n4. Commit your changes\n5. Push to the branch\n6. Open a Pull Request\n',
25
- 'author': 'Craig Trim',
26
- 'author_email': 'craigtrim@gmail.com',
27
- 'maintainer': 'Craig Trim',
28
- 'maintainer_email': 'craigtrim@gmail.com',
29
- 'url': 'https://github.com/craigtrim/fast-sentence-segment',
30
- 'packages': packages,
31
- 'package_data': package_data,
32
- 'install_requires': install_requires,
33
- 'entry_points': entry_points,
34
- 'python_requires': '>=3.9,<4.0',
35
- }
36
-
37
-
38
- setup(**setup_kwargs)