jacksonllee / pycantonese

Cantonese Linguistics and NLP
https://pycantonese.org
MIT License
362 stars 39 forks source link

Windows support #28

Closed Ngkaokis closed 3 years ago

Ngkaokis commented 3 years ago

I can successfully use pycantonese using wsl but crash in windows cmd/powershell

code:

import pycantonese
print(pycantonese.segment("廣東話容唔容易學?"))

Traceback:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
    return func(*args, **kwargs)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
Traceback (most recent call last):
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
  File "<string>", line 1, in <module>
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    results = super().map(partial(_process_chunk, fn),
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
    exitcode = _main(fd, parent_sentinel)
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    prepare(preparation_data)
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    _fixup_main_from_path(data['init_main_from_path'])
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    _run_code(code, mod_globals, init_globals,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    main_content = runpy.run_path(main_path,
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    return _run_module_code(code, init_globals, run_name,
Traceback (most recent call last):
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
  File "<string>", line 1, in <module>
    _run_code(code, mod_globals, init_globals,
    self._start_queue_management_thread()
    return _run_module_code(code, init_globals, run_name,
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    _run_code(code, mod_globals, init_globals,
    return Segmenter()
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
Traceback (most recent call last):
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    self._adjust_process_count()
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
  File "<string>", line 1, in <module>
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    p.start()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
    cls = _get_default_segmenter()
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    reader = _HKCanCorReader.from_dir(data_dir)
    exitcode = _main(fd, parent_sentinel)
    self._popen = self._Popen(self)
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    return Segmenter()
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    return Popen(process_obj)
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    self.fit(hkcancor().words(by_utterances=True))
    prepare(preparation_data)
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    prep_data = spawn.get_preparation_data(process_obj._name)
    self.fit(hkcancor().words(by_utterances=True))
    _fixup_main_from_path(data['init_main_from_path'])
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    return func(*args, **kwargs)
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    _run_code(code, mod_globals, init_globals,
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    _check_not_importing_main()
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    exec(code, run_globals)
    raise RuntimeError('''
    return func(*args, **kwargs)
    return _run_module_code(code, init_globals, run_name,
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    return _run_module_code(code, init_globals, run_name,
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    _run_code(code, mod_globals, init_globals,

  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    _run_code(code, mod_globals, init_globals,
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    return cls.from_files(
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    print(pycantonese.segment("廣東話容唔容易學?"))
    return func(*args, **kwargs)
    exec(code, run_globals)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    return Segmenter()
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    executor.map(self._parse_chat_str, strs, file_paths)
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    print(pycantonese.segment("廣東話容唔容易學?"))
    return cls.from_strs(strs, paths, parallel=parallel)
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    results = super().map(partial(_process_chunk, fn),
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
    return cls.from_strs(strs, paths, parallel=parallel)
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    reader = _HKCanCorReader.from_dir(data_dir)
    self.fit(hkcancor().words(by_utterances=True))
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    return func(*args, **kwargs)
    reader = _HKCanCorReader.from_dir(data_dir)
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    return func(*args, **kwargs)
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    reader._parse_chat_strs(strs, ids, parallel)
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    executor.map(self._parse_chat_str, strs, file_paths)
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    self._adjust_process_count()
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    results = super().map(partial(_process_chunk, fn),
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
Traceback (most recent call last):
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    results = super().map(partial(_process_chunk, fn),
    prepare(preparation_data)
    exitcode = _main(fd, parent_sentinel)
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    p.start()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
  File "<string>", line 1, in <module>
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    _fixup_main_from_path(data['init_main_from_path'])
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    prepare(preparation_data)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    _fixup_main_from_path(data['init_main_from_path'])
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    reader._parse_chat_strs(strs, ids, parallel)
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    return Popen(process_obj)
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
    main_content = runpy.run_path(main_path,
    return _run_module_code(code, init_globals, run_name,
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prepare(preparation_data)
Traceback (most recent call last):
    reader._parse_chat_strs(strs, ids, parallel)
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
  File "<string>", line 1, in <module>
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _fixup_main_from_path(data['init_main_from_path'])
    _run_code(code, mod_globals, init_globals,
    self._adjust_process_count()
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    self._adjust_process_count()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    executor.map(self._parse_chat_str, strs, file_paths)
    exec(code, run_globals)
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    p.start()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    exitcode = _main(fd, parent_sentinel)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    results = super().map(partial(_process_chunk, fn),
    _run_code(code, mod_globals, init_globals,
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    print(pycantonese.segment("廣東話容唔容易學?"))
    raise RuntimeError('''
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    p.start()
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
    results = super().map(partial(_process_chunk, fn),
    exec(code, run_globals)
    prepare(preparation_data)

    results = super().map(partial(_process_chunk, fn),
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
    _run_code(code, mod_globals, init_globals,
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    return Popen(process_obj)
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    _fixup_main_from_path(data['init_main_from_path'])
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    exec(code, run_globals)
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    cls = _get_default_segmenter()
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    self.fit(hkcancor().words(by_utterances=True))
    main_content = runpy.run_path(main_path,
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    prep_data = spawn.get_preparation_data(process_obj._name)
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    _check_not_importing_main()
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    self._start_queue_management_thread()
    reader = _HKCanCorReader.from_dir(data_dir)
    cls = _get_default_segmenter()
    return _run_module_code(code, init_globals, run_name,
    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    raise RuntimeError('''
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    self._adjust_process_count()
    self.fit(hkcancor().words(by_utterances=True))
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    self._adjust_process_count()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    return func(*args, **kwargs)
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    _run_code(code, mod_globals, init_globals,
    raise RuntimeError('''

  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    exec(code, run_globals)
    p.start()
    reader = _HKCanCorReader.from_dir(data_dir)
    self.fit(hkcancor().words(by_utterances=True))
    self._adjust_process_count()

  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    p.start()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    return func(*args, **kwargs)
    self._popen = self._Popen(self)
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    self._popen = self._Popen(self)
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    p.start()
    cls = _get_default_segmenter()
Traceback (most recent call last):
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
  File "<string>", line 1, in <module>
    return cls.from_files(
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    return Popen(process_obj)
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 116, in spawn_main
    prep_data = spawn.get_preparation_data(process_obj._name)
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    exitcode = _main(fd, parent_sentinel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    _check_not_importing_main()
    return cls.from_strs(strs, paths, parallel=parallel)
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 125, in _main
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    reader = _HKCanCorReader.from_dir(data_dir)
    prepare(preparation_data)
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 236, in prepare
    raise RuntimeError('''
    return cls.from_strs(strs, paths, parallel=parallel)
    raise RuntimeError('''
    _check_not_importing_main()
    return func(*args, **kwargs)
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    _fixup_main_from_path(data['init_main_from_path'])

  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
    return func(*args, **kwargs)

    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    raise RuntimeError('''
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    return cls.from_files(
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    return func(*args, **kwargs)
    reader._parse_chat_strs(strs, ids, parallel)
    main_content = runpy.run_path(main_path,
    results = super().map(partial(_process_chunk, fn),
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 265, in run_path
    reader._parse_chat_strs(strs, ids, parallel)

  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    return _run_module_code(code, init_globals, run_name,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 97, in _run_module_code
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
    _run_code(code, mod_globals, init_globals,
  File "D:\anaconda3\envs\lyricscrawler\lib\runpy.py", line 87, in _run_code
    executor.map(self._parse_chat_str, strs, file_paths)
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    exec(code, run_globals)
  File "E:\VisualStudioProject\FYP\lyrics_web_crawler\test.py", line 2, in <module>
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    results = super().map(partial(_process_chunk, fn),
    self._start_queue_management_thread()
    executor.map(self._parse_chat_str, strs, file_paths)
    print(pycantonese.segment("廣東話容唔容易學?"))
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    results = super().map(partial(_process_chunk, fn),
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 111, in segment
    self._adjust_process_count()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    cls = _get_default_segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 66, in _get_default_segmenter
    p.start()
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
    results = super().map(partial(_process_chunk, fn),
    return Segmenter()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\word_segmentation.py", line 43, in __init__
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
    self.fit(hkcancor().words(by_utterances=True))
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pycantonese\corpus.py", line 372, in hkcancor
    self._start_queue_management_thread()
    self._start_queue_management_thread()
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    reader = _HKCanCorReader.from_dir(data_dir)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    self._adjust_process_count()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    self._adjust_process_count()
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    return func(*args, **kwargs)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    p.start()
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 1010, in from_dir
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    self._adjust_process_count()
    p.start()
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 608, in _adjust_process_count
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
    return cls.from_files(
    raise RuntimeError('''
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    p.start()
    return func(*args, **kwargs)
    return Popen(process_obj)
    prep_data = spawn.get_preparation_data(process_obj._name)

  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\process.py", line 121, in start
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 962, in from_files
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    self._popen = self._Popen(self)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\context.py", line 327, in _Popen
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    return Popen(process_obj)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    return cls.from_strs(strs, paths, parallel=parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 153, in wrapper
    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
    return func(*args, **kwargs)
    raise RuntimeError('''
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 923, in from_strs
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    _check_not_importing_main()
  File "D:\anaconda3\envs\lyricscrawler\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main

    reader._parse_chat_strs(strs, ids, parallel)
  File "D:\anaconda3\envs\lyricscrawler\lib\site-packages\pylangacq\chat.py", line 213, in _parse_chat_strs
    executor.map(self._parse_chat_str, strs, file_paths)
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 674, in map
    results = super().map(partial(_process_chunk, fn),
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in map
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\_base.py", line 608, in <listcomp>
    fs = [self.submit(fn, *args) for args in zip(*iterables)]
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 645, in submit
    self._start_queue_management_thread()
  File "D:\anaconda3\envs\lyricscrawler\lib\concurrent\futures\process.py", line 584, in _start_queue_management_thread
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    self._adjust_process_count()
Ngkaokis commented 3 years ago

solved by adding if __name__ == '__main__' guard in the main module

jacksonllee commented 3 years ago

Oh yeah, pycantonese (through the underlying pylangacq package) has parallel code, and so it's important to run code under if __name__ == "__main__". I'll add a note about this in the documentation -- thank you for filing this ticket!