Skip to content

Instantly share code, notes, and snippets.

View philschmid's full-sized avatar

Philipp Schmid philschmid

View GitHub Profile
#!/bin/bash
docker login docker.pkg.github.com -u talosinsight -p TOKEN
docker pull docker.pkg.github.com/talosinsight/insight-translator/translator:latest
--//
@philschmid
philschmid / categorizeText.ts
Last active December 13, 2019 12:30
Multilabel categorizing talos mit gc nlp api and aws lambda
// Imports the Google Cloud client library
const language = require('@google-cloud/language');
// Creates a client
const client = new language.LanguageServiceClient();
const categorizeText = async(document:string) => {
// Prepares a document, representing the provided text
const document = {
@philschmid
philschmid / cloud_run.tf
Created December 2, 2019 10:31
cloudrun terraform
resource "google_cloud_run_service" "default" {
name = "tftest-cloudrun"
location = "us-central1"
provider = "google-beta"
metadata {
namespace = "my-project-name"
}
spec {
@philschmid
philschmid / _README.MD
Last active December 11, 2019 09:55
cloudbuild.yaml for cloud run on gcp

Cloudbuild Example for private github-repository + Docker build and push + run Terraform script

HOW TO

run tf apply var=_GIT_USERNAME=test var=_GIT_Password=abc .... lokal. This will create a cloudbuild-trigger on the defined branch
of the repository. Afterwards you can push to the Branch an the Cloudbuild will be triggered and run the steps definden in the cloudbuild.yam

@philschmid
philschmid / get_string_from_dict.py
Last active December 13, 2019 14:49
yake_lambda
def get_string_from_dict(input_dict=''):
try:
result_string=''
# loops trough dict
for key, value in input_dict.items():
# checks if value is string then translates it
if(type(value) == str or type(value_text) == int):
@philschmid
philschmid / __KnowYourGraph.ts
Last active January 3, 2020 13:48
Google Knowledge graph API --> typescript not tested. sollten aber nur ein paar kleine fehler sein.
const fetch = require('node-fetch');
import {transformEntities} from './transformEntities.ts'
const knowYourGraph = (apiKey:string, queryString:string, limit = 50, lng = "en") => {
return new Promise(async (resolve, reject) => {
try {
// building Url for Knowledge Graph
const url:string = `https://kgsearch.googleapis.com/v1/entities:search?indent=true&languages=${lng}&limit=${limit}&query=${queryString}&key=${apiKey}`;
// request API
const response = await fetch(url, {
headers: {
@philschmid
philschmid / article_creation.py
Last active February 24, 2020 06:25
cypher python api
def entity_parser(entity_array):
res_ent=[]
for ent in inpust_list:
if ent['sailence'] > 0 and ent['type] != 'OTHER':
res_ent.append({"name":ent['name'], "type":ent['type'].capitalize(),
"relation": f"is{ent['type'].capitalize()}", "sailence": ent['sailence']})
return res_ent
def create_article_script(input_article=None):
@philschmid
philschmid / add_entity_to_words.py
Last active January 31, 2020 06:24
automatic Ner Labeling dataset
def add_entity_to_words(sentence='',entities=''):
print(sentence)
res_sen_tpl = []
sentence= sentence.lower()
words_in_sentence = tokenize_to_word(sentence)
for wrd_idx,word in enumerate(words_in_sentence):
if len(word) > 1:
r_word = f"{word}"
word = word.lower()
for ent in entities:
@philschmid
philschmid / ideation.md
Last active February 3, 2020 07:41
Patent Crawler

Patent Crawler for Talos-jobs

  1. Talos-Job gets created
  2. Patent Crawler gets triggered once (noramlly it runs everyday once)
  3. Patent Crawler queries "company-patent-table" (not defined yet) should be a table where we match companies to patent assignee for example siemens healthineers doesn hold any patents but siemens healthcare does (not required @ beginning).
  4. Patent crawler request url with correct company (rather name not excatly defined and filter in csv), for example : Siemens
    a. url see below
    b. result is a csv
  5. patent crawler parses results and compares the result of csv with patent-link-table. (only add last 5-10 years)
  6. "new patents" which are not in the "patent-link-table" will be added and the patent crawler crawls them