<commit_before>import { Moment } from "moment-timezone";

import { IMenuItem } from "./IMenuItem";
import { IParser } from "./IParser";
import "./parserUtil";
import { Zomato } from "./zomato";

export class Tiffany extends Zomato implements IParser {
    public parse(html: string, date: Moment, doneCallback: (menu: IMenuItem[]) => void): void {
        const menuItems = super.parseBase(html, date);

        const soups = menuItems[0].text.replace(/^\s*[Pp]oli?evk[ay]\s*:\s*-\s*/, "").replace(/\s*\(0[.,]25\)\s*$/, "").split(",");
        menuItems.shift();
        for (const soup of soups) {
          menuItems.unshift({ isSoup: true, text: soup, price: NaN });
        }
        menuItems[menuItems.length - 1].isSoup = false; // last item is misidentified as soup
        doneCallback(menuItems);
    }
}
<commit_msg>better soup handling in tiffany<commit_after>import { Moment } from "moment-timezone";

import { IMenuItem } from "./IMenuItem";
import { IParser } from "./IParser";
import "./parserUtil";
import { Zomato } from "./zomato";

export class Tiffany extends Zomato implements IParser {
    public parse(html: string, date: Moment, doneCallback: (menu: IMenuItem[]) => void): void {
        const menuItems = super.parseBase(html, date);

        const soups = menuItems[0].text.replace(/^\s*[Pp]oli?evk[ay]\s*:\s*-\s*/, "").replace(/\s*\(0[.,]25l?\)\s*$/, "").split(",");
        menuItems.shift();
        for (const soup of soups) {
          menuItems.unshift({ isSoup: true, text: soup, price: NaN });
        }
        menuItems[menuItems.length - 1].isSoup = false; // last item is misidentified as soup
        doneCallback(menuItems);
    }
}

{'fraction_non_alphanumeric': 0.1721120186697783, 'fraction_numerical': 0.005834305717619603, 'mean_word_length': 2.853932584269663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4695241', 'n_tokens_mistral': 562, 'n_tokens_neox': 548, 'n_words': 138}