Skip to content

Commit 397ca8a

Browse files
author
Swaroop Manchala
committed
chore: align NL parser with project structure and docs
1 parent ac7fbae commit 397ca8a

12 files changed

+36
-2
lines changed
File renamed without changes.

docs/NL_PARSER.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Natural Language Parser (NL Parser)
2+
3+
## Overview
4+
The NL Parser enables users to describe installation requests in natural language
5+
(e.g., “install docker and kubernetes” or “set up python dev environment”).
6+
It converts free-form text into structured intents that Cortex can act upon.
7+
8+
This improves demo reliability and usability by removing the need for strict
9+
command syntax.
10+
11+
---
12+
13+
## Key Features
14+
- Typo tolerance (e.g., kubernets → kubernetes, pyhton → python)
15+
- Rule-based + fuzzy semantic intent detection
16+
- Confidence scoring for detected intent
17+
- Clarification prompts for ambiguous requests
18+
- Slot extraction (python version, platform, packages)
19+
- Lightweight, dependency-free core logic
20+
21+
---
22+
23+
## Usage Example
24+
25+
```python
26+
from cortex.nl_parser import parse_request
27+
28+
result = parse_request("pls install pyhton 3.10 on mac")
29+
30+
print(result)
31+
32+

tests/test_nl_parser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from nl_parser import parse_request
2+
from cortex.nl_parser import parse_request
33

44
@pytest.mark.parametrize("text,expected", [
55
("install something for machine learning", "install_ml"),
@@ -34,4 +34,6 @@ def test_corrections():
3434
def test_slot_extraction():
3535
r = parse_request("pls install python 3.10 on mac")
3636
assert r["slots"].get("python_version") == "3.10"
37-
assert r["slots"].get("platform") in ("mac", "macos")
37+
assert r["slots"].get("platform") in ("mac", "macos")
38+
39+

0 commit comments

Comments
 (0)