Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data


< > BotCompany Repo | #1028008 - Cool NLP Shopping List [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (7877L/41K).


cmodule ShoppingList > DynPrintLog {
  transient S input = [[
    okay shopping list
    buy bananas
    at least three
    I have to be cheap
    they have to be cheap
    buy potatoes
    also get some milk
    hold on I have a phone call
    hey Mom
    yes mam
    it's all good
    by Mom
    okay I'm back
    where were we
    buy some chicken
    or maybe no chicken
    okay that's all
  transient S rules = [[
    sentence => "(first/then/also/) we (will/) need (some/) <stuff>" => buy $1
    sentence => "(first/then/also/) (buy/get/you should get) (some/) <stuff>" => buy $1
    sentence => "they have to be <quality>" => last item has to be $1
    sentence => "at least <quantity>" => last item quantity at least $1
    sentence => "or (maybe/rather/) no <stuff>" => don't buy $1 after all

  LS intermediate; // intermediate result (buy X, ...)

  start-thread {
    new RecursiveProbabilisticParser1 parser;
    parser.splitIntoSentences = lambda1 tlft;

    setField(intermediate := recursiveProbabilisticParse(rules, "sentence", input, +parser));
    pnlWithHeading("Intermediate result", intermediate);

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028008
Snippet name: Cool NLP Shopping List [dev.]
Eternal ID of this version: #1028008/1
Text MD5: 4bfb396733a9f93c73881d7397ddb444
Transpilation MD5: d974e8db23a6bd5d20327edc2b7b6455
Author: stefan
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-01 19:31:57
Source code size: 1166 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 29 / 716
Referenced in: [show references]

Formerly at &