# LoSearch - Advanced Search Engine Library
[](https://python.org)
[](https://github.com/yourusername/losearch)
[](LICENSE)
A high-performance Python search library with intelligent relevance scoring, advanced indexing capabilities, and multilingual support for Persian and English.
## Features
- **Fast Document Search** - Optimized indexing and retrieval
- **Smart Query Correction** - Automatic typo detection and correction
- **Contextual Search** - Extract relevant sentences with context
- **Multilingual Support** - Persian and English language processing
- **Performance Optimization** - Intelligent caching and speed enhancements
- **Accuracy Enhancement** - Advanced relevance scoring algorithms
- **Text Analysis** - Comprehensive text processing utilities
- **Flexible API** - Simple yet powerful interface
## Installation
```bash
pip install losearch
```
## Quick Start
```python
import losearch as ls
# Initialize search engine
search = ls.LoSearch(enable_optimization=True)
# Add documents
documents = [
{"id": "1", "title": "MacBook Pro", "content": "High-performance laptop with M2 chip"},
{"id": "2", "title": "iPhone 15", "content": "Latest smartphone with advanced camera"}
]
search.add_documents(documents)
# Search with automatic optimization
results = search.search("laptop performance")
for result in results:
print(f"{result['title']} - Score: {result['score']}")
```
## Core Components
### Main Classes
- **LoSearch** - Primary interface for all search operations
- **LoSearchEngine** - Advanced search engine with optimization
- **TextProcessor** - Text normalization and language processing
- **ContextExtractor** - Intelligent context and sentence extraction
- **SpeedOptimizer** - Performance optimization and caching
- **AccuracyEnhancer** - Result quality improvement
### Search Methods
#### Basic Search
```python
results = search.search("machine learning", limit=10)
```
#### Smart Search with Auto-Correction
```python
result = search.smart_search("machne lerning") # Automatically corrects typos
```
#### Contextual Search
```python
result = search.contextual_search("AI algorithms", mode='advanced')
```
#### Contextual Search with Scoring
```python
result = search.contextual_search_with_scores("deep learning", top_sentences=3)
```
## Advanced Usage
### Text Analysis
```python
analysis = search.analyze_text("Machine learning and artificial intelligence")
print(f"Language: {analysis['language']}")
print(f"Terms: {analysis['terms']}")
```
### Query Correction
```python
correction = search.fix_query("machne lerning")
print(f"Corrected: {correction['corrected_query']}")
print(f"Confidence: {correction['confidence']}")
```
### Performance Monitoring
```python
stats = search.get_performance_stats()
print(f"Documents indexed: {stats['documents_indexed']}")
print(f"Cache hit rate: {stats['speed_optimizer']['hit_rate']}")
```
## Multilingual Support
LoSearch provides seamless support for both Persian and English with automatic language detection:
```python
# English search
english_results = search.search("machine learning algorithms")
# Persian search
persian_results = search.search("یادگیری ماشین")
# Mixed language documents
mixed_docs = [
{"id": "1", "title": "AI Research", "content": "تحقیقات هوش مصنوعی"},
{"id": "2", "title": "Python Programming", "content": "برنامه نویسی پایتون"}
]
```
## Architecture
```
src/losearch/
├── core/ # Core search functionality
│ ├── engine.py # Main LoSearchEngine class
│ ├── search_engine.py # Base search engine
│ ├── speed_optimizer.py # Caching and optimization
│ └── accuracy_enhancer.py # Result accuracy improvement
├── utils/ # Utility modules
│ ├── text_processor.py # Text processing and normalization
│ └── context_extractor.py # Context and sentence extraction
└── __init__.py # Library interface
```
## Performance Features
### Speed Optimization
- Intelligent query caching
- Index optimization
- Memory-efficient processing
### Accuracy Enhancement
- Advanced relevance scoring
- Context-aware ranking
- Language-specific processing
## Use Cases
- E-commerce product search
- Document management systems
- Knowledge base applications
- Content discovery platforms
- Research and academic tools
- Multilingual applications
## Documentation
For comprehensive documentation, examples, and advanced usage:
**[Complete Tutorial](LoSearch_Tutorial.md)**
## Performance Tips
1. Enable optimization for better performance:
```python
search = ls.LoSearch(enable_optimization=True)
```
2. Use batch operations for multiple documents:
```python
search.add_documents(all_documents) # Preferred over individual adds
```
3. Use advanced mode for better contextual results:
```python
result = search.contextual_search(query, mode='advanced')
```
## Version 1.0.0
### What's New
- Complete rewrite with modular architecture
- Multi-language support (Persian/English)
- Smart query correction and auto-completion
- Contextual search with sentence extraction
- Performance optimization with intelligent caching
- Comprehensive text analysis capabilities
- Enhanced accuracy scoring algorithms
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Support
- Create an issue on GitHub for bug reports
- Check the [Complete Tutorial](LoSearch_Tutorial.md) for documentation
- Review examples in the documentation
---
**LoSearch** - Making search intelligent and fast
Raw data
{
"_id": null,
"home_page": "https://github.com/MadricTeam/LoSearch",
"name": "LoSearch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "search, indexing, text-processing, multilingual, persian, farsi",
"author": "Madric",
"author_email": "madric.offical@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/74/5b/aeab5472dc0f19e425aadb7b5cd8dcaf0e81be88a81f5701b3ad8109ca4d/losearch-0.1.1.post1.tar.gz",
"platform": null,
"description": "# LoSearch - Advanced Search Engine Library\r\n\r\n[](https://python.org)\r\n[](https://github.com/yourusername/losearch)\r\n[](LICENSE)\r\n\r\nA high-performance Python search library with intelligent relevance scoring, advanced indexing capabilities, and multilingual support for Persian and English.\r\n\r\n## Features\r\n\r\n- **Fast Document Search** - Optimized indexing and retrieval\r\n- **Smart Query Correction** - Automatic typo detection and correction\r\n- **Contextual Search** - Extract relevant sentences with context\r\n- **Multilingual Support** - Persian and English language processing\r\n- **Performance Optimization** - Intelligent caching and speed enhancements\r\n- **Accuracy Enhancement** - Advanced relevance scoring algorithms\r\n- **Text Analysis** - Comprehensive text processing utilities\r\n- **Flexible API** - Simple yet powerful interface\r\n\r\n## Installation\r\n\r\n```bash\r\npip install losearch\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\nimport losearch as ls\r\n\r\n# Initialize search engine\r\nsearch = ls.LoSearch(enable_optimization=True)\r\n\r\n# Add documents\r\ndocuments = [\r\n {\"id\": \"1\", \"title\": \"MacBook Pro\", \"content\": \"High-performance laptop with M2 chip\"},\r\n {\"id\": \"2\", \"title\": \"iPhone 15\", \"content\": \"Latest smartphone with advanced camera\"}\r\n]\r\n\r\nsearch.add_documents(documents)\r\n\r\n# Search with automatic optimization\r\nresults = search.search(\"laptop performance\")\r\nfor result in results:\r\n print(f\"{result['title']} - Score: {result['score']}\")\r\n```\r\n\r\n## Core Components\r\n\r\n### Main Classes\r\n\r\n- **LoSearch** - Primary interface for all search operations\r\n- **LoSearchEngine** - Advanced search engine with optimization\r\n- **TextProcessor** - Text normalization and language processing\r\n- **ContextExtractor** - Intelligent context and sentence extraction\r\n- **SpeedOptimizer** - Performance optimization and caching\r\n- **AccuracyEnhancer** - Result quality improvement\r\n\r\n### Search Methods\r\n\r\n#### Basic Search\r\n```python\r\nresults = search.search(\"machine learning\", limit=10)\r\n```\r\n\r\n#### Smart Search with Auto-Correction\r\n```python\r\nresult = search.smart_search(\"machne lerning\") # Automatically corrects typos\r\n```\r\n\r\n#### Contextual Search\r\n```python\r\nresult = search.contextual_search(\"AI algorithms\", mode='advanced')\r\n```\r\n\r\n#### Contextual Search with Scoring\r\n```python\r\nresult = search.contextual_search_with_scores(\"deep learning\", top_sentences=3)\r\n```\r\n\r\n## Advanced Usage\r\n\r\n### Text Analysis\r\n```python\r\nanalysis = search.analyze_text(\"Machine learning and artificial intelligence\")\r\nprint(f\"Language: {analysis['language']}\")\r\nprint(f\"Terms: {analysis['terms']}\")\r\n```\r\n\r\n### Query Correction\r\n```python\r\ncorrection = search.fix_query(\"machne lerning\")\r\nprint(f\"Corrected: {correction['corrected_query']}\")\r\nprint(f\"Confidence: {correction['confidence']}\")\r\n```\r\n\r\n### Performance Monitoring\r\n```python\r\nstats = search.get_performance_stats()\r\nprint(f\"Documents indexed: {stats['documents_indexed']}\")\r\nprint(f\"Cache hit rate: {stats['speed_optimizer']['hit_rate']}\")\r\n```\r\n\r\n## Multilingual Support\r\n\r\nLoSearch provides seamless support for both Persian and English with automatic language detection:\r\n\r\n```python\r\n# English search\r\nenglish_results = search.search(\"machine learning algorithms\")\r\n\r\n# Persian search \r\npersian_results = search.search(\"\u06cc\u0627\u062f\u06af\u06cc\u0631\u06cc \u0645\u0627\u0634\u06cc\u0646\")\r\n\r\n# Mixed language documents\r\nmixed_docs = [\r\n {\"id\": \"1\", \"title\": \"AI Research\", \"content\": \"\u062a\u062d\u0642\u06cc\u0642\u0627\u062a \u0647\u0648\u0634 \u0645\u0635\u0646\u0648\u0639\u06cc\"},\r\n {\"id\": \"2\", \"title\": \"Python Programming\", \"content\": \"\u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u067e\u0627\u06cc\u062a\u0648\u0646\"}\r\n]\r\n```\r\n\r\n## Architecture\r\n\r\n```\r\nsrc/losearch/\r\n\u251c\u2500\u2500 core/ # Core search functionality\r\n\u2502 \u251c\u2500\u2500 engine.py # Main LoSearchEngine class\r\n\u2502 \u251c\u2500\u2500 search_engine.py # Base search engine\r\n\u2502 \u251c\u2500\u2500 speed_optimizer.py # Caching and optimization\r\n\u2502 \u2514\u2500\u2500 accuracy_enhancer.py # Result accuracy improvement\r\n\u251c\u2500\u2500 utils/ # Utility modules\r\n\u2502 \u251c\u2500\u2500 text_processor.py # Text processing and normalization\r\n\u2502 \u2514\u2500\u2500 context_extractor.py # Context and sentence extraction\r\n\u2514\u2500\u2500 __init__.py # Library interface\r\n```\r\n\r\n## Performance Features\r\n\r\n### Speed Optimization\r\n- Intelligent query caching\r\n- Index optimization\r\n- Memory-efficient processing\r\n\r\n### Accuracy Enhancement\r\n- Advanced relevance scoring\r\n- Context-aware ranking\r\n- Language-specific processing\r\n\r\n## Use Cases\r\n\r\n- E-commerce product search\r\n- Document management systems\r\n- Knowledge base applications\r\n- Content discovery platforms\r\n- Research and academic tools\r\n- Multilingual applications\r\n\r\n## Documentation\r\n\r\nFor comprehensive documentation, examples, and advanced usage:\r\n\r\n**[Complete Tutorial](LoSearch_Tutorial.md)**\r\n\r\n## Performance Tips\r\n\r\n1. Enable optimization for better performance:\r\n```python\r\nsearch = ls.LoSearch(enable_optimization=True)\r\n```\r\n\r\n2. Use batch operations for multiple documents:\r\n```python\r\nsearch.add_documents(all_documents) # Preferred over individual adds\r\n```\r\n\r\n3. Use advanced mode for better contextual results:\r\n```python\r\nresult = search.contextual_search(query, mode='advanced')\r\n```\r\n\r\n## Version 1.0.0\r\n\r\n### What's New\r\n- Complete rewrite with modular architecture\r\n- Multi-language support (Persian/English)\r\n- Smart query correction and auto-completion\r\n- Contextual search with sentence extraction\r\n- Performance optimization with intelligent caching\r\n- Comprehensive text analysis capabilities\r\n- Enhanced accuracy scoring algorithms\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Support\r\n\r\n- Create an issue on GitHub for bug reports\r\n- Check the [Complete Tutorial](LoSearch_Tutorial.md) for documentation\r\n- Review examples in the documentation\r\n\r\n---\r\n\r\n**LoSearch** - Making search intelligent and fast\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A high-performance Python search library with intelligent relevance scoring, advanced indexing capabilities, and multilingual support for Persian and English.",
"version": "0.1.1.post1",
"project_urls": {
"Bug Reports": "https://github.com/MadricTeam/LoSearch/issues",
"Documentation": "https://github.com/MadricTeam/LoSearch/blob/main/LoSearch_Tutorial.md",
"Homepage": "https://github.com/MadricTeam/LoSearch",
"Source": "https://github.com/MadricTeam/LoSearch"
},
"split_keywords": [
"search",
" indexing",
" text-processing",
" multilingual",
" persian",
" farsi"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8ff877b6ca96c1e6e4cf569110d3b459ec6a3c9adfde52d60a2bef6856fbd66b",
"md5": "b1070bbc8af896ff953408693d1a50b6",
"sha256": "5399752fb6d0541c27e4a7cd5e166c43e8a3df6e61e9120d8f9578105ec239d1"
},
"downloads": -1,
"filename": "losearch-0.1.1.post1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b1070bbc8af896ff953408693d1a50b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16867,
"upload_time": "2025-08-29T13:23:10",
"upload_time_iso_8601": "2025-08-29T13:23:10.562278Z",
"url": "https://files.pythonhosted.org/packages/8f/f8/77b6ca96c1e6e4cf569110d3b459ec6a3c9adfde52d60a2bef6856fbd66b/losearch-0.1.1.post1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "745baeab5472dc0f19e425aadb7b5cd8dcaf0e81be88a81f5701b3ad8109ca4d",
"md5": "5fb5c09f24e24a3c60a48eccea671f96",
"sha256": "5248816ab3a1337337e10217da02c3c4e6134c16c9e39071c476e1cba1203dea"
},
"downloads": -1,
"filename": "losearch-0.1.1.post1.tar.gz",
"has_sig": false,
"md5_digest": "5fb5c09f24e24a3c60a48eccea671f96",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 21696,
"upload_time": "2025-08-29T13:23:12",
"upload_time_iso_8601": "2025-08-29T13:23:12.009572Z",
"url": "https://files.pythonhosted.org/packages/74/5b/aeab5472dc0f19e425aadb7b5cd8dcaf0e81be88a81f5701b3ad8109ca4d/losearch-0.1.1.post1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-29 13:23:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MadricTeam",
"github_project": "LoSearch",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "losearch"
}