This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.polyLine = new H.map.Polyline( | |
this.lineString, {style: {lineWidth: 4, strokeColor: "#62A8EA", lineDash: [4]}} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dateutil.relativedelta import relativedelta | |
# def date_iter_periodicity(start_date, end_date, hold_days): | |
# date = start_date | |
# while date < end_date: | |
# yield (date), (date + datetime.timedelta(hold_days)) | |
# date += datetime.timedelta(hold_days) | |
def date_iter_periodicity(start_date, end_date, interval): | |
date = start_date | |
while date < end_date: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def 獲利年數(data): | |
eps = data.get('稀釋每股盈餘合計', 4*10).fillna(0) | |
count = 0 | |
for start, end in zip(range(0, 37, 4), range(4, 41, 4)): | |
if not (eps.iloc[start:end].empty): | |
count += eps.iloc[start:end].sum() > 0 | |
return count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = require('../../config') | |
const axios = require('axios') | |
const md5 = require('md5') | |
const KKBOX = require('../api/KKBOX') | |
class Olami { | |
constructor(appKey = config.olami.appKey, appSecret = config.olami.appSectet, inputType = 1) { | |
this.URL = 'https://tw.olami.ai/cloudservice/api' | |
this.appKey = appKey | |
this.appSecret = appSecret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {LineHandler} = require('bottender') | |
const olami = require('./nlp/Olami') | |
exports.lineHandler = new LineHandler() | |
.onText(async context => { | |
const text = context.event.text | |
const userId = context._session.user.id | |
const reply = await olami.nli(text, userId) | |
await context.reply([reply.toLineMessage()]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {LineHandler} = require('bottender') | |
const olami = require('./nlp/Olami') | |
exports.lineHandler = new LineHandler() | |
.onText(async context => { | |
const text = context.event.text | |
const userId = context._session.user.id | |
const reply = await olami.nli(text, userId) | |
await context.replyText(reply) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
import logging | |
import telegram | |
from flask import Flask, request | |
from telegram import ReplyKeyboardMarkup | |
from telegram.ext import Dispatcher, CommandHandler, MessageHandler, Filters | |
from nlp.olami import Olami |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+from api.kkbox import KKBOX | |
class Olami: | |
def intent_detection(self, nli_obj): | |
+ def handle_music_kkbox_type(semantic): | |
+ music_type = semantic['modifier'][0].split('_')[2] | |
+ slots = semantic['slots'] | |
+ kkbox = KKBOX() | |
+ | |
+ def get_slot_value_by_key(key): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
import json | |
import logging | |
import time | |
from hashlib import md5 | |
from api.kkbox import KKBOX | |
import requests | |
config = configparser.ConfigParser() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
import logging | |
import requests | |
config = configparser.ConfigParser() | |
config.read('config.ini') | |
logger = logging.getLogger(__name__) |
NewerOlder