repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
NickMonzillo/SmartCloud
SmartCloud/__init__.py
<filename>SmartCloud/__init__.py<gh_stars>1-10 from random import randint,choice from os.path import isdir, isfile from wordplay import tuplecount,separate, read_file from utils import dir_freq, dir_list, read_dir, assign_colors, colorize, assign_fonts, fontsize import pygame class Cloud(object): def __init__(self...
NickMonzillo/SmartCloud
SmartCloud/wordplay.py
def separate(text): '''Takes text and separates it into a list of words''' alphabet = 'abcdefghijklmnopqrstuvwxyz' words = text.split() standardwords = [] for word in words: newstr = '' for char in word: if char in alphabet or char in alphabet.upper(): news...
NickMonzillo/SmartCloud
setup.py
<gh_stars>1-10 from distutils.core import setup setup( name = 'SmartCloud', packages = ['SmartCloud'], author_email = '<EMAIL>', url = 'https://github.com/NickMonzillo/SmartCloud', version = '1.0.1', description = 'Text visualization using word frequencies.', author='<NAME>', install_req...
NickMonzillo/SmartCloud
SmartCloud/utils.py
<reponame>NickMonzillo/SmartCloud<gh_stars>1-10 from os import listdir from wordplay import eliminate_repeats, read_file def dir_freq(directory): '''Returns a list of tuples of (word,# of directories it occurs)''' content = dir_list(directory) i = 0 freqdict = {} for filename in content: fil...
zgw426/OpenCV_SamplesForMyself
opcvCapImg01_drawID_outImg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 from PIL import Image targetImg = "test-img02.png" aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) outputImg = "edit01-" + targetImg[0:-4]+".png" def arReader( argTargetImg , argOutputImg ): img = cv2.imread( argTargetI...
zgw426/OpenCV_SamplesForMyself
opcvCapVideo05_drawAxis_outMP4.py
<filename>opcvCapVideo05_drawAxis_outMP4.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import sys import cv2.aruco as aruco import numpy as np #targetVideo = 0 # カメラデバイス #targetVideo = "test-video.mp4" # 動画 #targetVideo = "http://{IP Address}:8090/?action=stream" # MJPG-Streamer targetVideo = "test-vi...
zgw426/OpenCV_SamplesForMyself
opcv_outputARmark01.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ↓ $ pip install opencv-contrib-python import cv2 aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) def arGenerator(): fileName = "ar.png" generator = aruco.drawMarker(dictionary, 0, 150) # 0: ID番号,150x150ピクセル cv2.imwrite(fileN...
zgw426/OpenCV_SamplesForMyself
opcvCapImg07_drawIMG_outImg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from PIL import Image import cv2 targetImg = "test-img02.png" mappingImg = "test-mapping.png" aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) outputImg = "edit07-" + targetImg[0:-4]+".png" aruco_dict = aruco.Dictionar...
zgw426/OpenCV_SamplesForMyself
opcv_outputARmark02.py
<reponame>zgw426/OpenCV_SamplesForMyself #!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 # ArUcoのライブラリを導入 aruco = cv2.aruco # 4x4のマーカー,ID番号は50までの辞書を使う dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) def main(): # 10枚のマーカーを作るために10回繰り返す for i in range(10): ar_image = aruco.drawM...
zgw426/OpenCV_SamplesForMyself
opcvCapImg08_drawAxis_outImg.py
<reponame>zgw426/OpenCV_SamplesForMyself<filename>opcvCapImg08_drawAxis_outImg.py<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 from PIL import Image import numpy as np targetImg = "test-img02.png" aruco = cv2.aruco outputImg = "edit08-" + targetImg[0:-4]+".png" dictionary = aruco.getPredefi...
zgw426/OpenCV_SamplesForMyself
opcvCapVideo04_drawText_outMP4.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import sys import cv2.aruco as aruco import numpy as np #targetVideo = 0 # カメラデバイス #targetVideo = "test-video.mp4" # 動画 #targetVideo = "http://{IP Address}:8090/?action=stream" # MJPG-Streamer targetVideo = "test-video.mp4" cap = cv2.VideoCapture( targetVideo...
zgw426/OpenCV_SamplesForMyself
opcvCapImg04_drawRectangle_outImg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 from PIL import Image import numpy as np targetImg = "test-img02.png" aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) outputImg = "edit04-" + targetImg[0:-4]+".png" def arReader( argTargetImg , argOutputImg ): img = cv2...
zgw426/OpenCV_SamplesForMyself
opcvCapImg02_drawText_outImg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 from PIL import Image import numpy as np targetImg = "test-img02.png" aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) outputImg = "edit02-" + targetImg[0:-4]+".png" def arReader( argTargetImg , argOutputImg ): img = cv2...
zgw426/OpenCV_SamplesForMyself
opcvCapImg06_drawPolylines_outImg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 from PIL import Image import numpy as np targetImg = "test-img02.png" aruco = cv2.aruco dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) outputImg = "edit06-" + targetImg[0:-4]+".png" def arReader( argTargetImg , argOutputImg ): img = cv2...
zgw426/OpenCV_SamplesForMyself
opcvCapVideo07_drawVideo_outMP4.py
<reponame>zgw426/OpenCV_SamplesForMyself #!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import sys import cv2.aruco as aruco import numpy as np #targetVideo = 0 # カメラデバイス #targetVideo = "test-video.mp4" # 動画 #targetVideo = "http://{IP Address}:8090/?action=stream" # MJPG-Streamer targetVideo = "test-video....
zgw426/OpenCV_SamplesForMyself
opcvCapVideo02_drawID_outMP4.py
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import sys import cv2.aruco as aruco #targetVideo = 0 # カメラデバイス #targetVideo = "test-video.mp4" # 動画 #targetVideo = "http://{IP Address}:8090/?action=stream" # MJPG-Streamer targetVideo = "test-video.mp4" outputVideo = "editV02.mp4" cap = cv2.Vid...
ayushpetigara/Guardian-Angel
app.py
<filename>app.py from flask import Flask, render_template, request, url_for, redirect, Markup, jsonify, make_response, send_from_directory, session import os is_prod = os.environ.get('IS_HEROKU', None) longitudeHistory = [None] latitudeHistory = [None] if is_prod == None: from keys import * else: API_KEY = os.environ...
Saevon/syncrae
management/commands/runsyncrae.py
from django.core.management.base import BaseCommand # optparse AND argparse??? from django.conf import settings from webdnd.syncrae.config.log import setup as logging_setup from webdnd.syncrae.websocket import get_app import argparse import logging import tornado.ioloop def cmdline(args=None, version=''): parser ...
Saevon/syncrae
events/queue.py
<gh_stars>0 from collections import defaultdict from syncrae.events.event import Event from syncrae.utils.decorators import cascade class Queue(object): queues = {} def __init__(self, id): self._all = set() self.id = id # Make sure the factory still works self.queues[id] = se...
Saevon/syncrae
events/event.py
<gh_stars>0 from django.conf import settings from syncrae.utils.decorators import cascade import json import logging logging = logging.getLogger() class Event(object): topic = None data = None def __init__(self, topic, data, err=False): self.topic = topic self.data = data self.__j...
Saevon/syncrae
terminal.py
from django.conf import settings from syncrae.events.event import Event from webdnd.player.models.roll import roll_text import logging logging = logging.getLogger('') class Terminal(object): def __init__(self, web): self.web = web def __call__(self, data): full_cmd = data.get('cmd') ...
Saevon/syncrae
config/log.py
<reponame>Saevon/syncrae<filename>config/log.py from logutils.colorize import ColorizingStreamHandler import logging # Customize error colors # levels to (background, foreground, bold/intense) ColorizingStreamHandler.level_map = { logging.DEBUG: (None, 'cyan', False), # Use default color for info messages ...
Saevon/syncrae
websocket.py
<gh_stars>0 from django.conf import settings from django.contrib.auth import get_user from django.utils.importlib import import_module from webdnd.player.models.roll import roll_text from webdnd.player.models.campaigns import Campaign from events.queue import CampaignQueue, ChatQueue, CharacterQueue from functools im...
Saevon/syncrae
config/settings.py
# Syncrae Application settings SYNCRAE_PORT = 8888 SYNCRAE_TORNADO_SETTINGS = { 'port': SYNCRAE_PORT, } # format: 'major.minor.bug name' SYNCRAE_VERSION = '0.3.0 BETA' # Loging info SYNCRAE_LOG_LEVEL = 'INFO' SYNCRAE_LOG_FILE = None SYNCRAE_ERR_CODES = { # All err codes start with a '5' to represent Sync...
Saevon/syncrae
session.py
import logging logging = logging.getLogger() class Session(object): ''' Persists a session across tabs, so you can have multiple websockets across different browsers/tabs etc. ''' all = {} STATUSES = { 'on': 'Online', 'off': 'Offline', } def __init__(self, listener):...
Saevon/syncrae
utils/decorators.py
<filename>utils/decorators.py from functools import wraps def cascade(func): """ class method decorator, always returns the object that called the method """ @wraps(func) def wrapper(self, *args, **kwargs): func(self, *args, **kwargs) return self return wrapper
Saevon/syncrae
webdnd_api.py
<reponame>Saevon/syncrae from settings import settings from utils.decorators import cascade import logging import simplejson import urllib import urllib2 class Api(object): WEBDND = 'localhost:9000' def __init__(self, key, endpoint, data=None): self.__key = key self.__endpoint = endpoint ...
JanuszBedkowski/observation_equations
codes/python-scripts/point-to-point-metrics/point_to_point_source_to_landmark_rodrigues_wc.py
<filename>codes/python-scripts/point-to-point-metrics/point_to_point_source_to_landmark_rodrigues_wc.py from sympy import * import sys sys.path.insert(1, '..') from tait_bryan_R_utils import * from rodrigues_R_utils import * from quaternion_R_utils import * x_L, y_L, z_L = symbols('x_L y_L z_L') x_s, y_s, z_s = symbol...
JanuszBedkowski/observation_equations
codes/python-scripts/example_func/example_func_ax_plus_b_eq_y_jacobian.py
<reponame>JanuszBedkowski/observation_equations from sympy import * x, y, a, b = symbols('x y a b') all_symbols = [a,b] target_value = y model_function = a*x + b obs_eq = Matrix([target_value - model_function]).vec() obs_eq_jacobian = obs_eq.jacobian(all_symbols) print(model_function) print(obs_eq) print(obs_eq_jaco...
JanuszBedkowski/observation_equations
codes/python-scripts/point-to-point-metrics/point_to_point_source_to_landmark_tait_bryan_wc_cov.py
<filename>codes/python-scripts/point-to-point-metrics/point_to_point_source_to_landmark_tait_bryan_wc_cov.py from sympy import * import sys sys.path.insert(1, '..') from tait_bryan_R_utils import * from rodrigues_R_utils import * from quaternion_R_utils import * x_L, y_L, z_L = symbols('x_L y_L z_L') x_s, y_s, z_s = s...
JanuszBedkowski/observation_equations
codes/python-scripts/plot-csv.py
<gh_stars>1-10 #!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np import argparse # try: # import seaborn as sns # sns.set(style='whitegrid',font_scale=1.2) # except: # print("Run:\nsudo pip3 install seaborn") fname='sample-data-to-plot.csv' delim=',' SIZE=(14,10) def plot_csv(fn...
RaeedAhmed/pyaastream
src/pyaastream/terms.py
<gh_stars>0 formats = [ ".mkv", ".mk3d", ".mp4", ".mov", ".qt", ".asf", ".wmv", ".avi", ".mxf", ".m2p", ".ps", ".ts", ".tsv", ".m2ts", ".mts", ".vob", ".evo", ".3gp", ".3g2", ".f4v", ".flv", ".ogv", ".ogx", ".Org", ".web...
RaeedAhmed/pyaastream
src/pyaastream/__init__.py
<reponame>RaeedAhmed/pyaastream """Torrent/Magnet browser and handler script""" __version__ = "0.4.5"
RaeedAhmed/pyaastream
src/pyaastream/main.py
<reponame>RaeedAhmed/pyaastream<gh_stars>0 import math import platform import re import shlex import shutil import subprocess import urllib.parse import urllib.request from typing import NamedTuple from urllib.error import HTTPError, URLError from bs4 import BeautifulSoup as bs from sty import ef, fg, rs from pyaastr...
0x71d3/text-prob
src/text_prob/__init__.py
from .gpt2_prob import GPT2Prob
0x71d3/text-prob
src/text_prob/gpt2_prob.py
from typing import Optional import torch from torch.nn import CrossEntropyLoss from transformers import AutoTokenizer, AutoModelForCausalLM class GPT2Prob: def __init__( self, pretrained_model_name_or_path: str, do_segmentation: Optional[bool] = False, use_mecab: Optional[bool] = ...
0x71d3/text-prob
tests/test_gpt2_prob.py
import pytest from text_prob import GPT2Prob def test_gpt2_prob(): text = '人間 と 同 程度 に 言語 を 理解 する こと の できる 人工 知能 システム に ついて 研究 して い ます 。' prob = GPT2Prob('nlp-waseda/gpt2-small-japanese-wikipedia') assert prob(text) == 0.04528525471687317 @pytest.mark.parametrize('use_mecab', [False, True]) def test_gpt...
Gunjanph/GSchedular
Scheduler_Test/oopinsta.py
import os import requests,sys,webbrowser,bs4 import urllib import re import time from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options chrome_o...
Gunjanph/GSchedular
run.py
from flask import Flask, render_template, url_for, flash, redirect from forms import LoginForm app = Flask(__name__) app.config['SECRET_KEY'] = 'qwertyuiop' @app.route("/") @app.route('/login.html', methods=['GET', 'POST']) def login(): form = LoginForm() if form.validate_on_submit(): flash(f'Login Successful for...
Gunjanph/GSchedular
insta.py
<reponame>Gunjanph/GSchedular import os import requests,sys,webbrowser,bs4 import urllib import re import time from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.o...
Gunjanph/GSchedular
heroku_Test/app/script.py
from datetime import datetime now=datetime.now().time() a=now.strftime("%H:%M:%S") a=[int(i) for i in a.split(':')] mint=a[1] while 1: now=datetime.now().time() a=now.strftime("%H:%M:%S") a=[int(i) for i in a.split(':')] if(a[2]==0) and a[1]!=mint: print(now) mint=a[1]
Gunjanph/GSchedular
Scheduler_Test/test.py
from selenium import webdriver username = "Your Username" password = "<PASSWORD>" getdriver = ("https://www.instagram.com/accounts/login/") driver = webdriver.Firefox() driver.get(getdriver) driver.find_element_by_xpath("//input[@name='username']").send_keys(username) driver.find_element_by_xpath("//input[@name='pa...
Gunjanph/GSchedular
Scheduler_Test/jj.py
import requests,sys,webbrowser,bs4 import urllib import re import time from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options chrome_options = Op...
mspector/expertise
expertise/evaluators/precision_at_m.py
from operator import itemgetter import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib from openreview_matcher.evals import base_evaluator from openreview_matcher import utils matplotlib.style.use('ggplot') class Evaluator(base_evaluator.Evaluator): """ An Evaluator instan...
mspector/expertise
expertise/test/__main__.py
''' ''' import argparse import os import json from collections import OrderedDict import expertise from expertise.config import ModelConfig def test_model(args): config_path = os.path.abspath(args.config_path) with open(config_path) as f: data = json.load(f, object_pairs_hook=OrderedDict) confi...
mspector/expertise
expertise/preprocess/textrank/textrank_chunks.py
from expertise.preprocess.textrank import TextRank def keyphrases(text): textrank = TextRank() textrank.analyze(text, chunks=True) return [word for word, _ in textrank.keyphrases()]
mspector/expertise
expertise/models/tfidf/setup_tfidf.py
import os import argparse import expertise default_config = { 'name': '', 'dataset': { 'directory': '' }, 'experiment_dir': './', 'min_count_for_vocab': 1, 'num_processes': 4, 'random_seed': 9, 'max_num_keyphrases': 25, 'max_seq_length': 512, 'do_lower_case': True, '...
mspector/expertise
expertise/models/tfidf/tfidf.py
from __future__ import absolute_import, print_function, unicode_literals import sys, os import re from collections import defaultdict from collections import Counter from gensim.similarities import SparseMatrixSimilarity from gensim.models import TfidfModel from gensim import corpora import ipdb class Model(): ...
mspector/expertise
expertise/config/core.py
from collections import OrderedDict import json import random import os import pickle import pkgutil import expertise class ModelConfig(object): def __init__(self, **kwargs): self._config = {} # valid_model_names = expertise.available_models() # if not 'model' in kwargs: # rais...
mspector/expertise
expertise/models/centroid/centroid.py
<filename>expertise/models/centroid/centroid.py import numpy as np import torch import torch.nn as nn from torch.nn import BCEWithLogitsLoss from expertise import utils from expertise.evaluators.mean_avg_precision import eval_map from expertise.evaluators.hits_at_k import eval_hits_at_k class Model(torch.nn.Module)...
mspector/expertise
expertise/models/centroid/train.py
<reponame>mspector/expertise<gh_stars>10-100 import datetime, os, sys, csv from shutil import copyfile, copytree import pickle import torch import torch.optim as optim import numpy as np from expertise.models import centroid from expertise.utils import save_dict_to_json from expertise.utils.vocab import Vocab from e...
mspector/expertise
expertise/models/tpms/tpms.py
import os import csv, json from collections import defaultdict from expertise.evaluators.mean_avg_precision import eval_map from expertise.evaluators.hits_at_k import eval_hits_at_k from expertise.dataset import Dataset from expertise import utils import ipdb def setup(config): assert os.path.exists(config.tpms_s...
mspector/expertise
expertise/utils/shuffle_big_file.py
''' Pseudocode from: https://blog.janestreet.com/how-to-shuffle-a-big-dataset/?utm_source=share ''' import argparse import random import json import os from tqdm import tqdm from . import utils def lazy_reader(filepath): with open(filepath) as f: for line in f: yield line def build_folds(sam...
mspector/expertise
expertise/__init__.py
<filename>expertise/__init__.py from .core import * from . import config from . import dataset from . import models from . import preprocess from . import setup from . import test from . import train from . import utils
mspector/expertise
expertise/models/randomize/randomize.py
<filename>expertise/models/randomize/randomize.py import numpy as np class Model(): def __init__(self): pass def fit(self, **kwargs): pass def score(self): return np.random.random() # def __init__(self): # self.reviewers = set() # pass # def fit(self, tra...
mspector/expertise
expertise/utils/vocab.py
<reponame>mspector/expertise import codecs import numpy as np from collections import Counter import csv import io # Note, because I used sets when I constructed the reviewer keyphrase file, I end up with # count_keyphrases being a count based on number of documents containing the keyphrase. def count_keyphrases(revie...
mspector/expertise
expertise/models/centroid/__init__.py
<reponame>mspector/expertise from __future__ import absolute_import from .centroid import * from .setup import setup from .train import train from .test import test
mspector/expertise
expertise/models/centroid_scibert_kps/__init__.py
<reponame>mspector/expertise<filename>expertise/models/centroid_scibert_kps/__init__.py from __future__ import absolute_import from .centroid_scibert_kps import * from .setup_centroid_scibert import setup from .train_centroid_scibert import train from .test_centroid_scibert import test
mspector/expertise
expertise/utils/summarize_kfold.py
<reponame>mspector/expertise ''' This script should summarize the results of an experiment across K folds ''' import argparse import os from expertise.config import ModelConfig import random import ipdb import csv import numpy as np def get_scores(config, k): old_experiment_dir = config.experiment_dir new_expe...
mspector/expertise
expertise/models/tpms/__init__.py
<filename>expertise/models/tpms/__init__.py from .tpms import *
mspector/expertise
expertise/preprocess/bert/setup_bert_lookup.py
<gh_stars>10-100 import csv, importlib, itertools, json, math, os, pickle, random from collections import defaultdict import numpy as np import openreview from expertise.utils.batcher import Batcher from expertise.dataset import Dataset from expertise.config import ModelConfig import expertise.utils as utils from exp...
mspector/expertise
expertise/preprocess/bert/__init__.py
<filename>expertise/preprocess/bert/__init__.py from .core import get_embeddings
mspector/expertise
expertise/evaluators/mean_avg_precision.py
<reponame>mspector/expertise """ Copyright (C) 2017-2018 University of Massachusetts Amherst. This file is part of "learned-string-alignments" http://github.com/iesl/learned-string-alignments Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License....
mspector/expertise
expertise/utils/standard_test.py
<filename>expertise/utils/standard_test.py<gh_stars>0 import os from collections import defaultdict from expertise import utils from expertise.dataset import Dataset from expertise.evaluators.mean_avg_precision import eval_map from expertise.evaluators.hits_at_k import eval_hits_at_k from tqdm import tqdm def test(con...
mspector/expertise
expertise/preprocess/pos_regex.py
<gh_stars>10-100 from __future__ import print_function import os import json import itertools import string import nltk from .. import utils def keyphrases(text): ''' keyphrases should accept one argument, text, which is a string. returns a list of normalized keyphrases. ''' return extract_candid...
mspector/expertise
expertise/models/bert/__init__.py
from __future__ import absolute_import from .bert import *
mspector/expertise
expertise/utils/prepare_kfold.py
<filename>expertise/utils/prepare_kfold.py ''' This script should "multiply" a directory's config file across K folds ''' import argparse import os from expertise.config import ModelConfig import random import ipdb def prepare_kfold(args, k): config_path = os.path.abspath(args.config_path) experiment_path = os....
mspector/expertise
expertise/models/centroid_scibert_kps/test_centroid_scibert.py
<filename>expertise/models/centroid_scibert_kps/test_centroid_scibert.py import torch import os from expertise.utils.batcher import Batcher from expertise.models import centroid_scibert_kps as centroid_scibert from expertise import utils def test(config): print('config.best_model_path', config.best_model_path) ...
mspector/expertise
expertise/utils/batcher.py
""" Copyright (C) 2017-2018 University of Massachusetts Amherst. This file is part of "learned-string-alignments" http://github.com/iesl/learned-string-alignments Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the...
mspector/expertise
expertise/models/centroid_scibert/centroid_scibert.py
<gh_stars>10-100 import numpy as np # import fastText as ft import torch import torch.nn as nn from torch.nn import BCEWithLogitsLoss from expertise import utils from expertise.evaluators.mean_avg_precision import eval_map from expertise.evaluators.hits_at_k import eval_hits_at_k import ipdb class Model(torch.nn.M...
mspector/expertise
expertise/setup/__main__.py
<gh_stars>10-100 ''' ''' import argparse import os import json from collections import OrderedDict import expertise from expertise.config import ModelConfig from .core import setup_model parser = argparse.ArgumentParser() parser.add_argument('config_path', help="a config file for a model") parser.add_argument('addit...
mspector/expertise
expertise/evaluators/recall_at_m.py
from __future__ import print_function, absolute_import import sys, os from operator import itemgetter import pandas as pd import matplotlib.pyplot as plt import matplotlib matplotlib.style.use('ggplot') class Evaluator(): """ An Evaluator instance that evaluates recall_at_m = (number of papers ...
mspector/expertise
expertise/preprocess/textrank/textrank_words.py
from .textrank import TextRank def keyphrases(text, include_scores=False, include_tokenlist=False): textrank = TextRank() textrank.analyze(text, chunks=False) tokenlist = [word for sentence in textrank.sentences for word in sentence] top_tokens = [(word, _) if include_scores else word for word, _ in textrank.keyph...
mspector/expertise
expertise/core.py
<filename>expertise/core.py import pkgutil from . import models def model_importers(): return {m: i for i, m, _ in pkgutil.iter_modules(models.__path__)} def available_models(): return [k for k in model_importers().keys()] def load_model(module_name): return model_importers()[module_name].find_module(module...
mspector/expertise
expertise/preprocess/words.py
from expertise.preprocess.textrank import TextRank def keyphrases(text): textrank = TextRank() segmented_sentences = textrank.sentence_segment(text) return [word for sentence in segmented_sentences for word in sentence]
mspector/expertise
expertise/models/centroid_scibert/train_centroid_scibert.py
<reponame>mspector/expertise import datetime, os, sys, csv from shutil import copyfile, copytree import pickle import torch import torch.optim as optim import numpy as np from expertise.models import centroid_scibert from expertise import utils from expertise.utils.vocab import Vocab from expertise.utils.batcher imp...
mspector/expertise
expertise/create_dataset.py
<reponame>mspector/expertise<gh_stars>0 ''' A script for generating a dataset. Assumes that the necessary evidence-collecting steps have been done, and that papers have been submitted. ''' import os, json, argparse from datetime import datetime import openreview from tqdm import tqdm from collections import defaul...
mspector/expertise
expertise/preprocess/keyphrases_pke.py
import json import os import pickle import pke import string import sys from nltk.corpus import stopwords from .. import utils def keyphrases(data_dir): ''' Given a directory containing reviewer archives or submissions, generate a dict keyed on signatures whose values are sets of keyphrases. The inp...
mspector/expertise
expertise/config/__main__.py
<gh_stars>10-100 ''' ''' from __future__ import absolute_import import argparse import os import pkgutil import expertise parser = argparse.ArgumentParser() parser.add_argument('model', help=f'select one of {expertise.available_models()}') parser.add_argument('--outfile', '-o', help='file to write config') args = p...
mspector/expertise
expertise/preprocess/textrank/__main__.py
import argparse import json import os from collections import OrderedDict from expertise.config import ModelConfig from .core import run_textrank if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('config_path', help="a config file for a model") args = parser.parse_args() ...
mspector/expertise
expertise/dataset/helpers.py
import os import json from openreview import Tag from expertise import utils from tqdm import tqdm def filter_by_fields(content, fields): filtered_record = {field: value for field, value in content.items() if field in fields} return filtered_record def read_json_records(data_dir, return_batches): for file...
mspector/expertise
expertise/utils/data_to_sample.py
<filename>expertise/utils/data_to_sample.py<gh_stars>10-100 import argparse import os from . import utils def data_to_sample(data, vocab, max_num_keyphrases): ''' Converts one line of the training data into a training sample. Training samples consist of the following: source: a numpy array co...
mspector/expertise
expertise/setup/core.py
import os from collections import OrderedDict import json import expertise def setup_model(args): config_path = os.path.abspath(args.config_path) with open(config_path) as f: data = json.load(f, object_pairs_hook=OrderedDict) config = expertise.config.ModelConfig(**data) return config
mspector/expertise
expertise/models/centroid_scibert/__init__.py
<filename>expertise/models/centroid_scibert/__init__.py from __future__ import absolute_import from .centroid_scibert import * from .setup_centroid_scibert import setup from .train_centroid_scibert import train from .test_centroid_scibert import test
mspector/expertise
expertise/preprocess/__init__.py
from . import bert from . import textrank
mspector/expertise
setup.py
<filename>setup.py from setuptools import setup setup( name='openreview-expertise', version='0.1', description='OpenReview paper-reviewer affinity modeling', url='https://github.com/iesl/openreview-evidence', author='<NAME>', author_email='<EMAIL>', license='MIT', packages=[ 'ex...
mspector/expertise
expertise/preprocess/chunks.py
<gh_stars>10-100 from expertise.preprocess.textrank import TextRank def keyphrases(text): textrank = TextRank() chunked_sentences = textrank.sentence_segment_chunk(text) return [word for sentence in chunked_sentences for word in sentence]
mspector/expertise
expertise/models/tfidf/test_tfidf.py
<filename>expertise/models/tfidf/test_tfidf.py<gh_stars>0 import argparse import os import csv, json import numpy as np from collections import defaultdict import expertise from expertise.dataset import Dataset from expertise.evaluators.mean_avg_precision import eval_map from expertise.evaluators.hits_at_k import eval_...
mspector/expertise
expertise/preprocess/bert/setup_bert_kps_lookup.py
import csv, importlib, itertools, json, math, os, pickle, random from collections import defaultdict import numpy as np import openreview from expertise.utils.batcher import Batcher from expertise.dataset import Dataset from expertise.config import ModelConfig import expertise.utils as utils from expertise.utils.data...
mspector/expertise
expertise/utils/batcher_devtest.py
""" Copyright (C) 2017-2018 University of Massachusetts Amherst. This file is part of "learned-string-alignments" http://github.com/iesl/learned-string-alignments Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the...
mspector/expertise
expertise/models/randomize/__init__.py
from __future__ import absolute_import from .randomize import *
mspector/expertise
expertise/preprocess/textrank/__init__.py
from .core import * from .textrank import TextRank from .textrank_words import keyphrases
mspector/expertise
expertise/models/centroid/test.py
import torch import os from expertise import utils from expertise.utils.batcher import Batcher from expertise.models import centroid def test(config): print('config.best_model_path', config.best_model_path) test_dir = os.path.join(config.experiment_dir, 'test') if not os.path.isdir(test_dir): os.mk...
mspector/expertise
expertise/preprocess/bert/__main__.py
<reponame>mspector/expertise<filename>expertise/preprocess/bert/__main__.py import argparse import os import json from collections import OrderedDict from expertise import utils from expertise.config import ModelConfig from .setup_bert_kps_lookup import setup_bert_kps_lookup from .setup_bert_lookup import setup_bert_...
mspector/expertise
expertise/dataset/__init__.py
<reponame>mspector/expertise from .core import Dataset from .helpers import filter_by_fields, read_json_records, get_items_generator
mspector/expertise
expertise/models/centroid_scibert_cls/setup_centroid_scibert.py
<filename>expertise/models/centroid_scibert_cls/setup_centroid_scibert.py<gh_stars>10-100 import csv, importlib, itertools, json, math, os, pickle, random from collections import defaultdict import numpy as np import openreview from expertise.utils.vocab import Vocab from expertise.utils.batcher import Batcher from e...
mspector/expertise
expertise/infer_model.py
''' Generate scores from the model defined by the config. ''' import argparse import importlib import os from expertise.config import Config def infer_model(config_path): config_path = os.path.abspath(config_path) experiment_path = os.path.dirname(config_path) config = Config(config_path) model = ...
mspector/expertise
expertise/setup/__init__.py
from .core import setup_model
czechflek/leaguedirector_evolved
leaguedirector/enable.py
<gh_stars>100-1000 import os import psutil import platform import logging import subprocess from PySide2.QtCore import * def findWindowsInstalled(paths): """ Find games installs in the windows registry. """ settings = QSettings('HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node', QSettings.NativeFormat); s...
czechflek/leaguedirector_evolved
leaguedirector/sequencer.py
<gh_stars>100-1000 import copy import threading import webbrowser import statistics from operator import attrgetter, methodcaller from PySide2.QtGui import * from PySide2.QtCore import * from PySide2.QtWidgets import * from leaguedirector.widgets import * PRECISION = 10000.0 SNAPPING = 4 OVERLAP = 4 ADJACENT = 0.05 ...