liveBook · Manning

Parsing

As explained in Vibe Engineering

String parsing is the process of interpreting character sequences and extracting their structured components.

A parsing script can run successfully while losing data or producing plausible but incorrect results. Parsing interprets strings and extracts structured components, often as part of cleaning and normalizing a dataset before analysis. AI can help generate the extraction logic, but its output needs verification against the data and business context. section 4.0 section 4.7

Parsing medicine compositions

A feature-engineering script can split Amoxycillin (500mg) into Salt_Name = Amoxycillin, Dosage_Value = 500, and Dosage_Unit = mg. Separately, it can set Is_Multi_Salt according to whether a second composition field is present. A prompt for a pandas script specifies these outputs and requests frequency counts, dosage counts, and sample rows for inspection. section 4.4

Listing 4.4 Output of feature engineering notebook
 
[1] Extracted 'Salt_Name'. Showing top 5 unique salts:
Salt_Name
Cefixime       8992
Domperidone    8869
Aceclofenac    8683
Amoxycillin    8550
Ofloxacin      6768
Name: count, dtype: int64
 
[2] Extracted 'Dosage_Value' and 'Dosage_Unit'.
Products with Dosage Value: 223054/253973
 
--- Feature Engineering Results (First 10 Rows) ---
| name                            | short_composition1        | Salt_Name     |   Dosage_Value | Dosage_Unit   | Is_Multi_Salt   |
|:--------------------------------|:--------------------------|:--------------|---------------:|:--------------|:----------------|
| Augmentin 625 Duo Tablet        | Amoxycillin  (500mg)      | Amoxycillin   |            500 | mg            | True            |
| Azithral 500 Tablet             | Azithromycin (500mg)      | Azithromycin  |            500 | mg            | False           |
| Ascoril LS Syrup                | Ambroxol (30mg/5ml)       | Ambroxol      |            nan | nan           | True            |
| Allegra 120mg Tablet            | Fexofenadine (120mg)      | Fexofenadine  |            120 | mg            | False           |
| Avil 25 Tablet                  | Pheniramine (25mg)        | Pheniramine   |             25 | mg            | False           |
| Allegra-M Tablet                | Montelukast (10mg)        | Montelukast   |             10 | mg            | True            |
| Amoxyclav 625 Tablet            | Amoxycillin  (500mg)      | Amoxycillin   |            500 | mg            | True            |
| Azee 500 Tablet                 | Azithromycin (500mg)      | Azithromycin  |            500 | mg            | False           |
| Atarax 25mg Tablet              | Hydroxyzine (25mg)        | Hydroxyzine   |             25 | mg            | False           |
| Ascoril D Plus Syrup Sugar Free | Phenylephrine (5mg)       | Phenylephrine |              5 | mg            | True            |

New data with engineered features saved to 'features_engineered_medicine_data.csv'.

The output reports dosage values for 223,054 of 253,973 products and shows parsed sample rows. The count measures coverage, not whether every extracted value is correct. section 4.4

| Alex Syrup                      | Phenylephrine (5mg/5ml)   | Phenylephrine |            nan | nan           | True            |

The sample includes Phenylephrine (5mg/5ml), for which the displayed dosage value and unit are missing. Such cases help identify patterns the extraction did not handle. section 4.4

Inspect both extracted values and missing results before using them as features. Small prompt adjustments can materially change extraction accuracy, but relying on an LLM alone can still leave valuable data behind. section 4.7 section 4.4

How Vibe Engineering covers it

How deep it goes
Specifies extracted columns and diagnostic output, but does not detail the parsing implementation in the supplied excerpt.
Examples
Extracts ingredient names, dosage values, and units from medicine compositions, including a sample with a missed compound dosage.
What it assumes
Assumes basic programming knowledge and notes that a fresh AI session needs additional data context.
What you can do after
Evaluate parsing results using extraction counts and sample rows, while checking for missing or incorrect values.
How it connects
Connects parsing to data cleaning, normalization, and feature engineering.

Also explained in

Compare how 17 books explain parsing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.