repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
espressopp | espressopp-master/doc/ug/conf.py | # -*- coding: utf-8 -*-
#
# ESPResSo++ documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 23 13:11:32 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | 7,631 | 32.038961 | 92 | py |
espressopp | espressopp-master/doc/ug/sphinxext/ipython_console_highlighting.py | """reST directive for syntax-highlighting ipython interactive sessions.
XXX - See what improvements can be made based on the new (as of Sept 2009)
'pycon' lexer for the python console. At the very least it will give better
highlighted tracebacks.
"""
#-----------------------------------------------------------------... | 4,183 | 35.382609 | 87 | py |
espressopp | espressopp-master/doc/ug/_themes/sphinx_rtd_theme/__init__.py | """Sphinx ReadTheDocs theme.
From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
"""
import os
__version__ = '0.1.10-alpha'
__version_full__ = __version__
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
retu... | 331 | 19.75 | 73 | py |
aflgo | aflgo-master/scripts/gen_distance_fast.py | #!/usr/bin/env python3
"""
Construct CG and calculate distances, similarly to genDistance.sh.
The distance is parallelized and uses the compiled distance calculation
version by default.
"""
import argparse
import multiprocessing as mp
import sys
import subprocess
from argparse import ArgumentTypeError as ArgTypeErr
fro... | 10,015 | 32.498328 | 81 | py |
aflgo | aflgo-master/scripts/add_edges.py | #!/usr/bin/env python
import argparse
import networkx as nx
def node_name (name):
if is_cg:
return "\"{%s}\"" % name
else:
return "\"{%s:" % name
def parse_edges (line):
edges = line.split ( )
n1_name = node_name (edges[0])
n1_list = filter (lambda (_, d): 'label' in d and n1_name in d['label'],... | 1,981 | 30.967742 | 110 | py |
aflgo | aflgo-master/scripts/merge_callgraphs.py | #!/usr/bin/env python3
import argparse
import networkx as nx
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--out', type=str, required=True, help="Path to output dot file.")
parser.add_argument('dot', nargs='+', help="Path to input dot files.")
args = parser.parse_args()
... | 566 | 21.68 | 96 | py |
aflgo | aflgo-master/scripts/distance.py | #!/usr/bin/env python3
import argparse
import collections
import functools
import networkx as nx
class memoize:
# From https://github.com/S2E/s2e-env/blob/master/s2e_env/utils/memoize.py
def __init__(self, func):
self._func = func
self._cache = {}
def __call__(self, *args):
if not isinstance(args... | 5,378 | 27.460317 | 139 | py |
jieba | jieba-master/setup.py | # -*- coding: utf-8 -*-
from distutils.core import setup
LONGDOC = """
jieba
=====
“结巴”中文分词:做最好的 Python 中文分词组件
"Jieba" (Chinese for "to stutter") Chinese text segmentation: built to
be the best Python Chinese word segmentation module.
完整文档见 ``README.md``
GitHub: https://github.com/fxsjy/jieba
特点
====
- 支持三种分词模式:... | 2,127 | 27 | 138 | py |
jieba | jieba-master/test/test_pos.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent)
for word, flag in result:
print(word, "/", flag, ", ", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。... | 2,821 | 27.22 | 128 | py |
jieba | jieba-master/test/test_whoosh_file.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys
import os
sys.path.append("../")
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEXT(stored=Tr... | 1,065 | 23.790698 | 108 | py |
jieba | jieba-master/test/test.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest("工信处女干事每月经过下属科室都要亲口交代24口... | 2,897 | 27.135922 | 128 | py |
jieba | jieba-master/test/extract_tags_with_weight.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_with_weight.py [file name] -k [top k] -w [with weight=1 or 0]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
parser.add_option("-w", dest="withWeight")
opt,... | 895 | 19.363636 | 101 | py |
jieba | jieba-master/test/jiebacmd.py | '''
usage example (find top 100 words in abc.txt):
cat abc.txt | python jiebacmd.py | sort | uniq -c | sort -nr -k1 | head -100
'''
from __future__ import unicode_literals
import sys
sys.path.append("../")
import jieba
default_encoding='utf-8'
if len(sys.argv)>1:
default_encoding = sys.argv[1]
while True:
... | 461 | 14.931034 | 76 | py |
jieba | jieba-master/test/extract_topic.py | import sys
sys.path.append("../")
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import decomposition
import jieba
import time
import glob
import sys
import os
import random
if len(sys.argv)<2:
print("usage: extract_topic.py di... | 1,463 | 21.875 | 70 | py |
jieba | jieba-master/test/test_multithread.py | #encoding=utf-8
import sys
import threading
sys.path.append("../")
import jieba
class Worker(threading.Thread):
def run(self):
seg_list = jieba.cut("我来到北京清华大学",cut_all=True)
print("Full Mode:" + "/ ".join(seg_list)) #全模式
seg_list = jieba.cut("我来到北京清华大学",cut_all=False)
print("Defau... | 696 | 22.233333 | 77 | py |
jieba | jieba-master/test/test_cut_for_search.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut_for_search(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和... | 2,778 | 27.070707 | 128 | py |
jieba | jieba-master/test/extract_tags_idfpath.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_idfpath.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
sy... | 594 | 17.030303 | 73 | py |
jieba | jieba-master/test/extract_tags.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
sys.exit(1... | 528 | 16.064516 | 65 | py |
jieba | jieba-master/test/test_whoosh_file_read.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys
import os
sys.path.append("../")
from whoosh.index import create_in,open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEXT... | 794 | 26.413793 | 108 | py |
jieba | jieba-master/test/test_lock.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import jieba
import threading
def inittokenizer(tokenizer, group):
print('===> Thread %s:%s started' % (group, threading.current_thread().ident))
tokenizer.initialize()
print('<=== Thread %s:%s finished' % (group, threading.current_thread().ident))
tokrs1 = [jieba.Tok... | 1,113 | 24.906977 | 82 | py |
jieba | jieba-master/test/test_no_hmm.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent,HMM=False)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest("工信处女干事每月经过下属科... | 2,833 | 27.059406 | 128 | py |
jieba | jieba-master/test/test_bug.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
import jieba.posseg as pseg
words=pseg.cut("又跛又啞")
for w in words:
print(w.word,w.flag)
| 191 | 16.454545 | 37 | py |
jieba | jieba-master/test/test_pos_no_hmm.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent, HMM=False)
for word, flag in result:
print(word, "/", flag, ", ", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一... | 2,832 | 27.33 | 128 | py |
jieba | jieba-master/test/test_change_dictpath.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent)
print(" ".join(result))
def testcase():
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest(... | 643 | 21.206897 | 53 | py |
jieba | jieba-master/test/test_whoosh.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys,os
sys.path.append("../")
from whoosh.index import create_in,open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse.analyzer import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEX... | 1,557 | 22.969231 | 113 | py |
jieba | jieba-master/test/test_userdict.py | #encoding=utf-8
from __future__ import print_function, unicode_literals
import sys
sys.path.append("../")
import jieba
jieba.load_userdict("userdict.txt")
import jieba.posseg as pseg
jieba.add_word('石墨烯')
jieba.add_word('凱特琳')
jieba.del_word('自定义词')
test_sent = (
"李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿\n"
"例如我输入一个带“韩玉赏鉴”的标题,在自... | 1,097 | 21.408163 | 99 | py |
jieba | jieba-master/test/jieba_test.py | #-*-coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
sys.path.append("../")
import unittest
import types
import jieba
if sys.version_info[0] > 2:
from imp import reload
jieba.initialize()
test_contents = [
"这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。",
"我不喜欢日本和服。",
"雷猴回... | 7,045 | 33.203883 | 120 | py |
jieba | jieba-master/test/demo.py | #encoding=utf-8
from __future__ import unicode_literals
import sys
sys.path.append("../")
import jieba
import jieba.posseg
import jieba.analyse
print('='*40)
print('1. 分词')
print('-'*40)
seg_list = jieba.cut("我来到北京清华大学", cut_all=True)
print("Full Mode: " + "/ ".join(seg_list)) # 全模式
seg_list = jieba.cut("我来到北京清华大学... | 1,994 | 22.470588 | 140 | py |
jieba | jieba-master/test/test_pos_file.py | from __future__ import print_function
import sys
import time
sys.path.append("../")
import jieba
jieba.initialize()
import jieba.posseg as pseg
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = list(pseg.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","w")
log_f.write(' /... | 403 | 17.363636 | 54 | py |
jieba | jieba-master/test/extract_tags_stop_words.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_stop_words.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
... | 658 | 18.382353 | 76 | py |
jieba | jieba-master/test/test_file.py | import time
import sys
sys.path.append("../")
import jieba
jieba.initialize()
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = "/ ".join(jieba.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","wb")
log_f.write(words.encode('utf-8'))
log_f.close()
print('cost ' + str(tm_c... | 383 | 16.454545 | 55 | py |
jieba | jieba-master/test/test_tokenize.py | #encoding=utf-8
from __future__ import print_function,unicode_literals
import sys
sys.path.append("../")
import jieba
g_mode="default"
def cuttest(test_sent):
global g_mode
result = jieba.tokenize(test_sent,mode=g_mode)
for tk in result:
print("word %s\t\t start: %d \t\t end:%d" % (tk[0],tk[1],tk[... | 3,394 | 30.728972 | 132 | py |
jieba | jieba-master/test/test_cutall.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent,cut_all=True)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Pytho... | 2,892 | 27.362745 | 128 | py |
jieba | jieba-master/test/test_paddle.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
jieba.enable_paddle()
def cuttest(test_sent):
result = jieba.cut(test_sent, use_paddle=True)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。"... | 2,935 | 27.504854 | 128 | py |
jieba | jieba-master/test/test_paddle_postag.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba.posseg as pseg
import jieba
jieba.enable_paddle()
def cuttest(test_sent):
result = pseg.cut(test_sent, use_paddle=True)
for word, flag in result:
print('%s %s' % (word, flag))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱... | 2,926 | 27.417476 | 128 | py |
jieba | jieba-master/test/test_tokenize_no_hmm.py | #encoding=utf-8
from __future__ import print_function,unicode_literals
import sys
sys.path.append("../")
import jieba
g_mode="default"
def cuttest(test_sent):
global g_mode
result = jieba.tokenize(test_sent,mode=g_mode,HMM=False)
for tk in result:
print("word %s\t\t start: %d \t\t end:%d" % (tk[0]... | 3,404 | 30.82243 | 132 | py |
jieba | jieba-master/test/parallel/test_pos.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent)
for w in result:
print(w.word, "/", w.flag, ", ", end=' ')
print("")
if __name__ == "... | 2,836 | 27.089109 | 128 | py |
jieba | jieba-master/test/parallel/test.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙... | 2,795 | 26.96 | 128 | py |
jieba | jieba-master/test/parallel/test_cut_for_search.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut_for_search(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手... | 2,637 | 26.479167 | 128 | py |
jieba | jieba-master/test/parallel/extract_tags.py | import sys
sys.path.append('../../')
import jieba
jieba.enable_parallel(4)
import jieba.analyse
from optparse import OptionParser
USAGE ="usage: python extract_tags.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k",dest="topK")
opt, args = parser.parse_args()
if len(args) <1:
pr... | 550 | 14.742857 | 64 | py |
jieba | jieba-master/test/parallel/test2.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent,cut_all=True)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个... | 2,639 | 26.5 | 128 | py |
jieba | jieba-master/test/parallel/test_pos_file.py | from __future__ import print_function
import sys,time
import sys
sys.path.append("../../")
import jieba
import jieba.posseg as pseg
jieba.enable_parallel(4)
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = list(pseg.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","w")
l... | 417 | 17.173913 | 54 | py |
jieba | jieba-master/test/parallel/test_file.py | import sys
import time
sys.path.append("../../")
import jieba
jieba.enable_parallel()
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = "/ ".join(jieba.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","wb")
log_f.write(words.encode('utf-8'))
print('speed %s bytes/second'... | 348 | 15.619048 | 55 | py |
jieba | jieba-master/test/parallel/test_disable_hmm.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent, HMM=False)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不... | 2,636 | 26.46875 | 128 | py |
jieba | jieba-master/jieba/__main__.py | """Jieba command line interface."""
import sys
import jieba
from argparse import ArgumentParser
from ._compat import *
parser = ArgumentParser(usage="%s -m jieba [options] filename" % sys.executable, description="Jieba command line interface.", epilog="If no filename specified, use STDIN instead.")
parser.add_argument... | 2,371 | 37.258065 | 180 | py |
jieba | jieba-master/jieba/_compat.py | # -*- coding: utf-8 -*-
import logging
import os
import sys
log_console = logging.StreamHandler(sys.stderr)
default_logger = logging.getLogger(__name__)
default_logger.setLevel(logging.DEBUG)
def setLogLevel(log_level):
default_logger.setLevel(log_level)
check_paddle_install = {'is_paddle_installed': False}
t... | 2,785 | 29.955556 | 110 | py |
jieba | jieba-master/jieba/__init__.py | from __future__ import absolute_import, unicode_literals
__version__ = '0.42.1'
__license__ = 'MIT'
import marshal
import re
import tempfile
import threading
import time
from hashlib import md5
from math import log
from . import finalseg
from ._compat import *
if os.name == 'nt':
from shutil import move as _rep... | 19,809 | 30.951613 | 109 | py |
jieba | jieba-master/jieba/lac_small/utils.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 4,319 | 29.20979 | 77 | py |
jieba | jieba-master/jieba/lac_small/reader_small.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 3,123 | 29.930693 | 74 | py |
jieba | jieba-master/jieba/lac_small/__init__.py | 0 | 0 | 0 | py | |
jieba | jieba-master/jieba/lac_small/creator.py | # -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 1,476 | 30.425532 | 79 | py |
jieba | jieba-master/jieba/lac_small/predict.py | # -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 2,626 | 31.036585 | 94 | py |
jieba | jieba-master/jieba/lac_small/nets.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 4,371 | 34.836066 | 100 | py |
jieba | jieba-master/jieba/posseg/viterbi.py | import sys
import operator
MIN_FLOAT = -3.14e100
MIN_INF = float("-inf")
if sys.version_info[0] > 2:
xrange = range
def get_top_states(t_state_v, K=4):
return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K]
def viterbi(obs, states, start_p, trans_p, emit_p):
V = [{}] # tabular
mem_p... | 1,610 | 28.833333 | 91 | py |
jieba | jieba-master/jieba/posseg/prob_trans.py | P={('B', 'a'): {('E', 'a'): -0.0050648453069648755,
('M', 'a'): -5.287963037107507},
('B', 'ad'): {('E', 'ad'): -0.0007479013978476627,
('M', 'ad'): -7.198613337130562},
('B', 'ag'): {},
('B', 'an'): {('E', 'an'): 0.0},
('B', 'b'): {('E', 'b'): -0.06753917715798491,
('M', ... | 247,312 | 45.592502 | 79 | py |
jieba | jieba-master/jieba/posseg/prob_start.py | P={('B', 'a'): -4.762305214596967,
('B', 'ad'): -6.680066036784177,
('B', 'ag'): -3.14e+100,
('B', 'an'): -8.697083223018778,
('B', 'b'): -5.018374362109218,
('B', 'bg'): -3.14e+100,
('B', 'c'): -3.423880184954888,
('B', 'd'): -3.9750475297585357,
('B', 'df'): -8.888974230828882,
('B', 'dg'): -3.14e+100,
('B'... | 7,204 | 27.035019 | 35 | py |
jieba | jieba-master/jieba/posseg/__init__.py | from __future__ import absolute_import, unicode_literals
import pickle
import re
import jieba
from .viterbi import viterbi
from .._compat import *
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab.p"
re_han_detail = re.compile("([\u4E00-\u9FD5... | 9,652 | 30.038585 | 97 | py |
jieba | jieba-master/jieba/posseg/prob_emit.py | from __future__ import unicode_literals
P={('B', 'a'): {'\u4e00': -3.618715666782108,
'\u4e07': -10.500566885381515,
'\u4e0a': -8.541143017159477,
'\u4e0b': -8.445222895280738,
'\u4e0d': -2.7990867583580403,
'\u4e11': -7.837979058356061,
... | 3,987,090 | 43.611807 | 77 | py |
jieba | jieba-master/jieba/posseg/char_state_tab.py | from __future__ import unicode_literals
P={'\u4e00': (('B', 'm'),
('S', 'm'),
('B', 'd'),
('B', 'a'),
('M', 'm'),
('B', 'n'),
('B', 'u'),
('E', 'r'),
('E', 'm'),
('M', 'd'),
('B', 's'),
... | 1,618,015 | 25.486642 | 78 | py |
jieba | jieba-master/jieba/finalseg/prob_trans.py | P={'B': {'E': -0.510825623765990, 'M': -0.916290731874155},
'E': {'B': -0.5897149736854513, 'S': -0.8085250474669937},
'M': {'E': -0.33344856811948514, 'M': -1.2603623820268226},
'S': {'B': -0.7211965654669841, 'S': -0.6658631448798212}}
| 241 | 47.4 | 60 | py |
jieba | jieba-master/jieba/finalseg/prob_start.py | P={'B': -0.26268660809250016,
'E': -3.14e+100,
'M': -3.14e+100,
'S': -1.4652633398537678}
| 93 | 17.8 | 29 | py |
jieba | jieba-master/jieba/finalseg/__init__.py | from __future__ import absolute_import, unicode_literals
import re
import os
import sys
import pickle
from .._compat import *
MIN_FLOAT = -3.14e100
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
PrevStatus = {
'B': 'ES',
'M': 'MB',
'S': 'SE',
'E': 'BM'
}
For... | 2,659 | 25.336634 | 100 | py |
jieba | jieba-master/jieba/finalseg/prob_emit.py | from __future__ import unicode_literals
P={'B': {'\u4e00': -3.6544978750449433,
'\u4e01': -8.125041941842026,
'\u4e03': -7.817392401429855,
'\u4e07': -6.3096425804013165,
'\u4e08': -8.866689067453933,
'\u4e09': -5.932085850549891,
'\u4e0a': -5.739552583325728,
'\u4e0b':... | 1,321,732 | 36.520453 | 39 | py |
jieba | jieba-master/jieba/analyse/tfidf.py | # encoding=utf-8
from __future__ import absolute_import
import os
import jieba
import jieba.posseg
from operator import itemgetter
_get_module_path = lambda path: os.path.normpath(os.path.join(os.getcwd(),
os.path.dirname(__file__), path))
_get_abs_path = jieba._get_abs... | 4,310 | 35.846154 | 93 | py |
jieba | jieba-master/jieba/analyse/textrank.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
from operator import itemgetter
from collections import defaultdict
import jieba.posseg
from .tfidf import KeywordExtractor
from .._compat import *
class UndirectWeightedGraph:
d = 0.85
def __in... | 3,772 | 32.990991 | 109 | py |
jieba | jieba-master/jieba/analyse/analyzer.py | # encoding=utf-8
from __future__ import unicode_literals
from whoosh.analysis import RegexAnalyzer, LowercaseFilter, StopFilter, StemFilter
from whoosh.analysis import Tokenizer, Token
from whoosh.lang.porter import stem
import jieba
import re
STOP_WORDS = frozenset(('a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', '... | 1,397 | 35.789474 | 82 | py |
jieba | jieba-master/jieba/analyse/__init__.py | from __future__ import absolute_import
from .tfidf import TFIDF
from .textrank import TextRank
try:
from .analyzer import ChineseAnalyzer
except ImportError:
pass
default_tfidf = TFIDF()
default_textrank = TextRank()
extract_tags = tfidf = default_tfidf.extract_tags
set_idf_path = default_tfidf.set_idf_path
t... | 501 | 25.421053 | 52 | py |
Dataset-3DPOP | Dataset-3DPOP-main/Util/VisualizeUtil.py | # !/usr/bin/env python3
""" Bunch of utility functions to visualize 3DPOP training data"""
import cv2
import math
import numpy as np
import re
def getColor(keyPoint):
if keyPoint.endswith("beak"):
return (255, 0 , 0 )
elif keyPoint.endswith("nose"):
return (63,133,205)
elif keyPoint.endswit... | 3,305 | 29.897196 | 122 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/mathPointOperations.py | # This code is used in case of simple math operations
from dis import dis
import cv2 as cv
import pandas as pd
import numpy as np
import h5py
def pointDistance3D(dict,dictNexus):
"""
Find distance between two points
:param dict: dict of 3D points
:param dictNexus: dict of 3D points
:return: dict ... | 4,413 | 31.455882 | 103 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/transformations.py | # Transformations contains all basic methods to transform from one coordinate system to another.
import pyquaternion as pq
import math
import numpy as np
# TODO: Remove function it is deprected
def worldToCameraSpace(pointList3D, rotationList, translationList):
"""
Transform point from one world to camera, ... | 19,531 | 37.223092 | 122 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/absoluteOrientation.py | #!/usr/bin/python
from numpy import *
from math import sqrt
from Math import transformations
# Input: expects 3xN matrix of points
# Returns R,t
# R = 3x3 rotation matrix
# t = 3x1 column vector
def findPoseFromPoints(pointsInCurrentFrameA, pointsInTargetFrameB,Name=None):
"""
Function finds pose to transfer... | 4,302 | 26.76129 | 93 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/BundleAdjustment.py | """
Author: Alex Chan
Functions to do bundle adjustment using scipy
Based on this online tutorial: https://scipy-cookbook.readthedocs.io/items/bundle_adjustment.html
"""
import scipy as sc
import urllib
import bz2
import os
import numpy as np
from scipy.sparse import lil_matrix
import matplotlib.pyplot as plt
from sc... | 5,952 | 32.632768 | 125 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/stereoComputation.py | # The file is created to store math related to stereo computation
from Math import transformations as tf
import numpy as np
import cv2 as cv
from System import objectVicon, imageVicon
from itertools import combinations
import pyquaternion as pq
from Math import BundleAdjustment as ba
class StereoTrinagulator:
def... | 18,616 | 44.518337 | 174 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/imageOperations.py | # The file contains functions to do image operations
import numpy as np
import cv2 as cv
from System import camera as cam
import math
# todo : Convert the function for processing more points at a time, the current method does it but the output is nested array for no reason.
def projectPointCamSpaceToImgSpace(point3d, ... | 3,523 | 34.59596 | 140 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/Math/__init__.py | # File to create a module for math manipulations
from Math import transformations
from Math import imageOperations
from Math import stereoComputation
from Math import mathPointOperations
from Math import absoluteOrientation | 223 | 36.333333 | 48 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/SettingsGenerator.py | """ Settings class for 3D POP AP for 3DPOP dataset"""
#import xml.etree.ElementTree as ET
from lxml import etree as ET
import os
class xmlSettingsParser:
def __init__(self, SettingsPath,InputTrial):
# filePath,CustomVideoName=None, ObjectID=None):
"""
Initialze the settings xm... | 9,439 | 40.043478 | 113 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/camera.py | # This class is used to provide
import numpy as np
import pyquaternion as pq
def loadDefaultCameraParam():
"""Loading fixed camera parameters for the video camera """
# 2118670 Camera ID VICON VUE
f = 2639.60557825127
px,py = [1010.59313964844 ,549.778747558594]
distParam = [3.5726620792918736e-008... | 4,218 | 35.686957 | 110 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/objectVicon.py | # The file is object for VICON. This is effective method for storing and
# accesing information about the vicon objects
from re import X
import numpy as np
import os
from Math import transformations as transferOp
from FileOperations import rwOperations
from Math import absoluteOrientation
import math
import pyquaterni... | 12,246 | 37.034161 | 138 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/imageVicon.py | from cmath import inf
from Math import imageOperations as imageOp
from Math import transformations as transformationOp
import numpy as np
import cv2 as cv
from DrawingOperations import drawOp
import os
class ImageVicon:
"""
Class handles images collected from vicon videos, computations of image projections an... | 14,079 | 35.858639 | 125 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/pointVicon.py | import numpy as np
class Point3D:
"""
class creates a 3D feature with name and coordinate information
"""
def __init__(self, point, name):
if len(point) != 3:
raise ValueError(" Need 3 parameters for Point3D class")
if len(name) == 0:
raise ValueError(" No stri... | 2,715 | 24.866667 | 95 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/__init__.py | # File to create a module for math manipulations
from System import camera
from System import systemInit
from System import objectVicon
from System import imageVicon
from System import videoVicon
from System import pointVicon | 225 | 31.285714 | 48 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/systemInit.py | import glob
import os
from FileOperations import loadVICONCalib
from FileOperations import rwOperations
from System import objectVicon
from Math import transformations as tf
from System import videoVicon
from System import imageVicon
import cv2 as cv
from System import camera
import numpy as np
import pickle
# Debug F... | 16,503 | 39.45098 | 151 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/System/videoVicon.py | import cv2 as cv
import os
from System import SettingsGenerator
import numpy as np
def setWindowName(path):
windowName = os.path.basename(path)
windowName = windowName.split(".avi")[0]
return windowName
class VideoVicon:
# todo : Global variable must have serialNo savedfor each object, so we can chec... | 5,542 | 31.040462 | 150 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/GenerateAnnotation/Generate2DKeypoints.py | """
Author: Alex Chan
Part of the auto-keypoint annotation pipeline, takes 3D keypoints and reproject to 2D for each camera view
"""
from System import systemInit as system
import os
from tqdm import tqdm
import pandas as pd
import numpy as np
import cv2 as cv
import pickle
import math
import multiprocessing as mp
f... | 6,580 | 33.455497 | 132 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/GenerateAnnotation/GenerateBBox.py | """
Author: Alex Chan
Part of the auto-keypoint annotation pipeline, takes 2D keypoint from each view,
outputs CSV for BBox for each subject
"""
import os
from tqdm import tqdm
import pandas as pd
import numpy as np
import math
def computeSubjectBoundingBox(Dict,subject,offset = 40):
"""
Author: Alex Chan
... | 5,027 | 31.43871 | 112 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/GenerateAnnotation/GenerateSubject2DKeypoints.py | """
Author: Alex Chan
Part of the auto-keypoint annotation pipeline,takes bounding boxes, crop to subject
then output mini video of subject through trial.
"""
from System import systemInit as system
import os
import matplotlib.pyplot as plt
from tqdm import tqdm
import pandas as pd
import numpy as np
import cv2 as c... | 15,268 | 39.181579 | 176 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/GenerateAnnotation/Generate3DKeypoints.py | """
Author: Alex Chan
Part of the auto-keypoint annotation pipeline, takes annotations and apply it accross whole
trial to generate 3D keypoints ground truth
"""
from logging.handlers import RotatingFileHandler
from System import systemInit as system
from FileOperations import rwOperations as fileOp
import os
from t... | 4,271 | 35.20339 | 121 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/prepareDataset.py |
#
from FileOperations import rwOperations
import glob
import os
import h5py
import pandas as pd
def processData(dataFrame, filterBboxData = True):
"""
Process data to remove all the non zero 2D coordinates from the given dataframe
:param dataFrame:
:return:
"""
print("Process")
featureLi... | 5,808 | 37.986577 | 177 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/loadVICONCalib.py | # The file generates read write functions to load vicon calibration file
# Currently only supported for custom class for RGB cameras, in future might add support for infrared camera
# Import .xml file and read the calibration parameters
from xml.dom import minidom
from System import camera as cam
import numpy as np
d... | 3,895 | 47.7 | 126 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/convertVICONExport.py | # The file has purpose of reading the original VICON.csv export file and convert it to locally readable export file.
# This format shall be similar to the file generated
import os
import pandas as pd
import csv
import math
import numpy as np
def separateObjectName(name):
separateColon = name.split(":")
print(... | 3,384 | 31.548077 | 116 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/__init__.py | # File to create a module for file operations
from FileOperations import loadVICONCalib
from FileOperations import rwOperations
from FileOperations import settingsGenerator
from FileOperations import prepareDataset
from FileOperations import convertVICONExport | 261 | 42.666667 | 46 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/rwOperations.py | # Read and Writing related helper functions for dealing with data series
import numpy as np
import pandas as pd
import os
import re
def readFeaturesFromFile(path):
"""
Loads features from the given file into a dictionary
:param : Path to text file with all required features
:return : return list of fe... | 33,951 | 36.516022 | 156 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/FileOperations/settingsGenerator.py | #import xml.etree.ElementTree as ET
from lxml import etree as ET
import os
class xmlSettingsParser:
def __init__(self, filePath, ObjectID=None):
"""
Initialze the settings xml class
:param rootDir: directory having the settings file
:param fileName: name of the settings file
... | 8,765 | 39.027397 | 111 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/makeMovie.py | import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
import os, sys
import numpy as np
def make_video_from_images(fileFormat,fileName,FPS=30.0,width=1280,height=720,displayImages=False):
"""
The function converts set of images into video using ffmpeg
:param fi... | 4,529 | 30.241379 | 126 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/drawOp.py | # The file contains list of functions which will draw the content on the given image file
import cv2 as cv
from DrawingOperations import generatePointsOp as pointGen
def getColor( keyPoint):
if keyPoint.endswith("beak"):
return (255, 0 , 0 )
elif keyPoint.endswith("nose"):
return (63,133,205)
... | 5,038 | 42.439655 | 104 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/generatePointsOp.py | # Generate points for drawing operations
def getCoordinatePoints(offset=100):
"""
Provides point of origin and point on XYZ axis at given offset, to draw coordinate system.
:param offset: point offset
:return: List of 3D points [Origin,X,Y,Z]
"""
og = [0, 0, 0]
xAxis = [offset, 0, 0]
yA... | 3,255 | 34.391304 | 123 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/imageAnnotation.py | # First prototype for the file to create annotation from the given image file and save them in respective feature
import cv2 as cv
import numpy as np
from System import videoVicon as vid
from FileOperations import rwOperations as rwOp
from FileOperations import settingsGenerator
from System import systemInit as system... | 23,103 | 37.961214 | 138 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/imageAnnotationTool.py | # First prototype for the file to create annotation from the given image file and save them in respective feature
import cv2 as cv
import numpy as np
from System import videoVicon as vid
from FileOperations import rwOperations as rwOp
from FileOperations import settingsGenerator
import pandas as pd
import os
def setP... | 16,815 | 37.045249 | 138 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/DrawingOperations/__init__.py | # File to create a module for file operations
from DrawingOperations import drawOp
from DrawingOperations import generatePointsOp
from DrawingOperations import imageAnnotation
from DrawingOperations import makeMovie | 215 | 42.2 | 46 | py |
Dataset-3DPOP | Dataset-3DPOP-main/POP3D_AP/ApplicationExamples/automaticAnnotationTool.py | """
The automatic annotation tool works in following way. It takes custom 3D feature information of given 6DOF VICON objects
(i.e. marker position of marker patterns and virtual features prepared through annotation protocol) and projects them on the image.
The final projected points are stored in the .csv file to creat... | 7,569 | 42.257143 | 141 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.