Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
MeetMartin / trainer.py
Created August 8, 2018 16:30
Rasa platform trainer Python script
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import warnings
from rasa_nlu.training_data import load_data
from rasa_nlu import config
@MeetMartin
MeetMartin / bot.py
Created August 8, 2018 18:25
Command line bot runner Python script for Rasa platform
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import warnings
from rasa_core import utils
from rasa_core.agent import Agent
@MeetMartin
MeetMartin / nlu-data.md
Created August 8, 2018 18:29
Rasa NLU configuration

language: "en"

pipeline:

  • name: "nlp_spacy"
  • name: "tokenizer_spacy"
  • name: "intent_entity_featurizer_regex"
  • name: "intent_featurizer_spacy"
  • name: "ner_crf"
  • name: "ner_spacy"
  • name: "ner_synonyms"
@MeetMartin
MeetMartin / weather.py
Created August 8, 2018 18:37
Weather Python action script for Rasa Core
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from rasa_core.actions.action import Action
# https://pypi.org/project/weather-api/
from weather import Weather, Unit
import React from 'react';
import { BrowserRouter as Router, Link } from 'react-router-dom';
import Routes from './Routes';
/**
* Base Template component holding the basic web application
* @returns {JSX}
*/
const App = () => (
import React from 'react';
import { BrowserRouter as Router, Link } from 'react-router-dom';
import Routes from './Routes';
/**
* Turns URL path into router basename by removing everything after the last slash
* @param {string} path URL path, probably window.location.pathname
* @returns {string} final basename
*/
@MeetMartin
MeetMartin / view-manager.js
Last active October 29, 2018 21:55
conditional expression view manager
import match from 'conditional-expression';
/**
* Sets active view based on current url
* @param {String} url url to be checked
* @return {String} getActiveView :: String -> String
*/
const getActiveView = url =>
match(url)
.includes('rapidView')
@MeetMartin
MeetMartin / view-manager.js
Created October 29, 2018 21:10
imperative view manager
/**
* Sets active view based on current url
* @param {String} url url to be checked
* @return {String} getActiveView :: String -> String
*/
function getActiveView(url) {
if(url.includes('rapidView')) {
if(url.includes('view=planning')) {
return 'Backlog';
} else if (url.includes('view=reporting')) {
@MeetMartin
MeetMartin / view-manager.js
Created October 29, 2018 21:13
ternaries view manager
/**
* Sets active view based on current url
* @param {String} url url to be checked
* @return {String} getActiveView :: String -> String
*/
const getActiveView = url =>
url.includes ('rapidView')
?
url.includes ('view=planning') ? 'Backlog' :
url.includes ('view=reporting') ? 'Reports' :
@MeetMartin
MeetMartin / authReducer.js
Last active October 29, 2018 22:19
imperative authReducer
import { SET_CURRENT_USER } from '../actions/types';
import { isEmpty } from '../../utilities/validations';
const initialState = {
isAuthenticated: false,
user: {}
};
/**
* Authentication reducer