Пример #1
0
    def setUp(self):
        WithTempDir.setUp(self)

        self.matrix = [[0.0, 0.5, 0.67, 0.8, 0.2], [0.5, 0.0, 0.4, 0.7, 0.6],
                       [0.67, 0.4, 0.0, 0.8, 0.8], [0.8, 0.7, 0.8, 0.0, 0.3],
                       [0.2, 0.6, 0.8, 0.3, 0.0]]
        self.taxa = ['German', 'Swedish', 'Icelandic', 'English', 'Dutch']
Пример #2
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.hlc = link_clustering.HLC(
         {
             "a": set(["b", "c"]),
             "b": set(["c"]),
             "c": set(["a"])
         }, set([("a", "b"), ("b", "c"), ("a", "c")]))
Пример #3
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.lex = LexStat(test_data('KSL.qlc'))
     self.part = Partial(test_data('partial_cognates.tsv'),
                         segments='segments')
     self.part.add_entries('pid1', 'partial_cognate_sets', lambda x: x)
     self.part.add_entries('pid2', 'partialids2',
                           lambda x: [int(y) for y in x.split(' ')])
Пример #4
0
    def setUp(self):
        WithTempDir.setUp(self)
        self.repos = self.tmp_path()

        self.languoids = self.tmp_path('languoids')
        copytree(Path(__file__).parent.joinpath('data', 'languoids'), self.languoids)
        self.tree = self.languoids.joinpath('tree')

        self.references = self.tmp_path('references')
        copytree(Path(__file__).parent.joinpath('data', 'references'), self.references)

        self.tmp_path('build').mkdir()
Пример #5
0
    def setUp(self):
        WithTempDir.setUp(self)
        self.repos = self.tmp_path()

        self.languoids = self.tmp_path('languoids')
        copytree(
            Path(__file__).parent.joinpath('data', 'languoids'),
            self.languoids)
        self.tree = self.languoids.joinpath('tree')

        self.references = self.tmp_path('references')
        copytree(
            Path(__file__).parent.joinpath('data', 'references'),
            self.references)

        self.tmp_path('build').mkdir()
Пример #6
0
    def setUp(self):
        WithTempDir.setUp(self)
        self.tmp_path('_test').mkdir()
        with self.tmp_path('_test', 'converter').open(mode='w',
                                                      encoding='utf8') as fp:
            fp.write("""\
p : p, ɸ, p͡f
b : b, β, b͡v
f : f
v : v
m : m, ɱ
w : w, ɰ, ʋ, ʍ
8 : θ, θ, Ɵ, ð""")

        with self.tmp_path('_test', 'scorer').open(mode='w',
                                                   encoding='utf8') as fp:
            fp.write(SCORER)
Пример #7
0
    def setUp(self):

        WithTempDir.setUp(self)
        self.gls = [('Haerbin', 0), ('Beijing', 0), ('Xi’an', 0),
                    ('Lanzhou', 0), ('Kunming', 1), ('Tianjin', 0),
                    ('edge.13', 1), ('edge.11', 0)]

        self.scenarios = [['p1', self.gls],
                          [
                              'p2',
                              [('Taiyuan', 0), ('Nanning', 0), ('Wenzhou', 0),
                               ('Lanzhou', 0), ('edge.24', 0), ('Pingyao', 0),
                               ('Jinan', 1), ('edge.6', 0), ('Kunming', 0),
                               ('Zhengzhou', 0), ('Xi’an', 0), ('edge.10', 0),
                               ('edge.14', 0), ('Shexian', 0), ('edge.26', 1),
                               ('Suzhou', 0)]
                          ]]

        self.tree = "((((((((Taiyuan,Pingyao,Huhehaote),((((Xi’an,Xining,Zhengzhou),(Lanzhou,Yinchuan,Wulumuqi)),(((Tianjin,Jinan),Qingdao),Beijing,Haerbin)),(((Guiyang,Kunming),Chengdu,Wuhan),(Nanjing,Hefei)))),(Xiangtan,Changsha)),Nanchang),(Shexian,Tunxi)),((Shanghai,Suzhou,Hangzhou),Wenzhou)),(((Xianggang,Guangzhou),Nanning),(Meixian,Taoyuan))),((((Xiamen,Taibei),Shantou,Haikou),Fuzhou),Jian’ou));"
Пример #8
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.alm = Alignments(test_data('KSL2.qlc'),
                           loans=False,
                           _interactive=False)
     self.alm.align()
Пример #9
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.wordlist = Wordlist(test_data('KSL.qlc'))
     self.wordlist2 = Wordlist(test_data('KSL4.qlc'))
Пример #10
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.cfg = os.path.join(self.tmp.as_posix(), '.config')
Пример #11
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.newick = '(((a,b),(c,d)),e);'
     self.tree = Tree(self.newick)
Пример #12
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.lex = self._make_one(test_data('KSL.qlc'))
     self.log = get_log()
     self.get_scorer_kw = dict(runs=10, rands=10, limit=100)
Пример #13
0
 def tearDown(self):
     # Reset the global _logger to make sure, it's recreated with appropriate config
     # when the other tests are run.
     log._logger = None
     WithTempDir.tearDown(self)
Пример #14
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.repos = self.tmp_path('repos')
     copytree(Path(__file__).parent.joinpath('data'), self.repos)
     self.api = Glottolog(self.repos)
Пример #15
0
 def tearDown(self):
     sys.stdout, sys.stderr = self._stdout, self._stderr
     WithTempDir.tearDown(self)
Пример #16
0
 def setUp(self):
     WithTempDir.setUp(self)
     self._stdout, sys.stdout = sys.stdout, StringIO()
     self._stderr, sys.stderr = sys.stderr, StringIO()
Пример #17
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.inputfile = os.path.join(
         os.path.dirname(lingpy.__file__), 'tests', 'test_data', 'phybo.qlc')
Пример #18
0
 def setUp(self):
     WithTempDir.setUp(self)
     self._stdout, sys.stdout = sys.stdout, StringIO()
     self._stderr, sys.stderr = sys.stderr, StringIO()
Пример #19
0
 def tearDown(self):
     sys.stdout, sys.stderr = self._stdout, self._stderr
     WithTempDir.tearDown(self)
Пример #20
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.wordlist = Wordlist(test_data('colexification.tsv'))
     self.cols = colx._get_colexifications(self.wordlist)
Пример #21
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.part = Partial(test_data('partial_cognates.tsv'),
                         segments='segments')
     self.part2 = Partial(test_data('partial_cognates-scored.tsv'),
                          segments='segments')