repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/pit.py
qlib/data/pit.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Qlib follow the logic below to supporting point-in-time database For each stock, the format of its data is <observe_time, feature>. Expression Engine support calculation on such format of data To calculate the feature value f_t at a specific...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/inst_processor.py
qlib/data/inst_processor.py
import abc import json import pandas as pd class InstProcessor: @abc.abstractmethod def __call__(self, df: pd.DataFrame, instrument, *args, **kwargs): """ process the data NOTE: **The processor could change the content of `df` inplace !!!!! ** User should keep a copy of data o...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/__init__.py
qlib/data/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function from .data import ( D, CalendarProvider, InstrumentProvider, FeatureProvider, ExpressionProvider, DatasetProvider, LocalCalendarProvider, Loca...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/base.py
qlib/data/base.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import abc import pandas as pd from ..log import get_module_logger class Expression(abc.ABC): """ Expression base class Expression is designed to handle the ca...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/cache.py
qlib/data/cache.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import os import sys import stat import time import pickle import traceback import redis_lock import contextlib import abc from pathlib import Path import numpy as np import ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
true
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/data.py
qlib/data/data.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import re import abc import copy import queue import bisect import numpy as np import pandas as pd from typing import List, Union, Optional # For supporting multiprocessing ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
true
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/storage/storage.py
qlib/data/storage/storage.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import re from typing import Iterable, overload, Tuple, List, Text, Union, Dict import numpy as np import pandas as pd from qlib.log import get_module_logger # calendar value type CalVT = str # instrument value InstVT = List[Tuple[CalVT, CalVT...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/storage/file_storage.py
qlib/data/storage/file_storage.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import struct from pathlib import Path from typing import Iterable, Union, Dict, Mapping, Tuple, List import numpy as np import pandas as pd from qlib.utils.time import Freq from qlib.utils.resam import resam_calendar from qlib.config import C ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/storage/__init__.py
qlib/data/storage/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from .storage import CalendarStorage, InstrumentStorage, FeatureStorage, CalVT, InstVT, InstKT __all__ = ["CalendarStorage", "InstrumentStorage", "FeatureStorage", "CalVT", "InstVT", "InstKT"]
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/_libs/__init__.py
qlib/data/_libs/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License.
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/loader.py
qlib/data/dataset/loader.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import abc import pickle from pathlib import Path import warnings import pandas as pd from typing import Tuple, Union, List, Dict from qlib.data import D from qlib.utils import load_dataset, init_instance_by_config, time_to_slc_point from qlib....
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/storage.py
qlib/data/dataset/storage.py
from abc import abstractmethod import pandas as pd import numpy as np from .handler import DataHandler from typing import Union, List from qlib.log import get_module_logger from .utils import get_level_index, fetch_df_by_index, fetch_df_by_col class BaseHandlerStorage: """ Base data storage for datahandler ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/handler.py
qlib/data/dataset/handler.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # coding=utf-8 from abc import abstractmethod import warnings from typing import Callable, Union, Tuple, List, Iterator, Optional import pandas as pd from qlib.typehint import Literal from ...log import get_module_logger, TimeInspector from ......
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/processor.py
qlib/data/dataset/processor.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import abc from typing import Union, Text, Optional import numpy as np import pandas as pd from qlib.utils.data import robust_zscore, zscore from ...constant import EPS from .utils import fetch_df_by_index from ...utils.serial import Serializabl...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/weight.py
qlib/data/dataset/weight.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. class Reweighter: def __init__(self, *args, **kwargs): """ To initialize the Reweighter, users should provide specific methods to let reweighter do the reweighting (such as sample-wise, rule-based). """ raise ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/utils.py
qlib/data/dataset/utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations import pandas as pd from typing import Union, List, TYPE_CHECKING from qlib.utils import init_instance_by_config if TYPE_CHECKING: from qlib.data.dataset import DataHandler def get_level_index(df: pd.DataF...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/data/dataset/__init__.py
qlib/data/dataset/__init__.py
from ...utils.serial import Serializable from typing import Callable, Union, List, Tuple, Dict, Text, Optional from ...utils import init_instance_by_config, np_ffill, time_to_slc_point from ...log import get_module_logger from .handler import DataHandler, DataHandlerLP from copy import copy, deepcopy from inspect impor...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/expm.py
qlib/workflow/expm.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from urllib.parse import urlparse import mlflow from filelock import FileLock from mlflow.exceptions import MlflowException, RESOURCE_ALREADY_EXISTS, ErrorCode from mlflow.entities import ViewType import os from typing import Optional, Text from ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/exp.py
qlib/workflow/exp.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Dict, List, Union from qlib.typehint import Literal import mlflow from mlflow.entities import ViewType from mlflow.exceptions import MlflowException from .recorder import Recorder, MLflowRecorder from ..log import get_module_lo...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/recorder.py
qlib/workflow/recorder.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os import sys from typing import Optional import mlflow import shutil import pickle import tempfile import subprocess import platform from pathlib import Path from datetime import datetime from qlib.utils.serial import Serializable from q...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/utils.py
qlib/workflow/utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import atexit import logging import sys import traceback from ..log import get_module_logger from . import R from .recorder import Recorder logger = get_module_logger("workflow", logging.INFO) # function to handle the experiment when unusual ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/__init__.py
qlib/workflow/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Motivation of this design (instead of using mlflow directly): - Better design than mlflow native design - we have record object with a lot of methods(more intuitive), instead of use run_id everytime in mlflow - So the recorder's in...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/record_temp.py
qlib/workflow/record_temp.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import logging import warnings import pandas as pd import numpy as np from tqdm import trange from pprint import pprint from typing import Union, List, Optional, Dict from qlib.utils.exceptions import LoadObjectError from ..contrib.evaluate im...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/task/manage.py
qlib/workflow/task/manage.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ TaskManager can fetch unused tasks automatically and manage the lifecycle of a set of tasks with error handling. These features can run tasks concurrently and ensure every task will be used only once. Task Manager will store all tasks in `Mon...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/task/gen.py
qlib/workflow/task/gen.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ TaskGenerator module can generate many tasks based on TaskGen and some task templates. """ import abc import copy import pandas as pd from typing import Dict, List, Union, Callable from qlib.utils import transform_end_date from .utils import ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/task/utils.py
qlib/workflow/task/utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Some tools for task management. """ import bisect from copy import deepcopy import pandas as pd from qlib.data import D from qlib.utils import hash_args from qlib.utils.mod import init_instance_by_config from qlib.workflow import R from qlib....
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/task/__init__.py
qlib/workflow/task/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Task related workflow is implemented in this folder A typical task workflow | Step | Description | |-----------------------+------------------------------------------------| | TaskGen ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/task/collect.py
qlib/workflow/task/collect.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Collector module can collect objects from everywhere and process them such as merging, grouping, averaging and so on. """ from collections import defaultdict from qlib.log import TimeInspector from typing import Callable, Dict, Iterable, Lis...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/online/update.py
qlib/workflow/online/update.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Updater is a module to update artifacts such as predictions when the stock data is updating. """ from abc import ABCMeta, abstractmethod from typing import Optional import pandas as pd from qlib import get_module_logger from qlib.data import...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/online/utils.py
qlib/workflow/online/utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ OnlineTool is a module to set and unset a series of `online` models. The `online` models are some decisive models in some time points, which can be changed with the change of time. This allows us to use efficient submodels as the market-style...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/online/__init__.py
qlib/workflow/online/__init__.py
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/online/manager.py
qlib/workflow/online/manager.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ OnlineManager can manage a set of `Online Strategy <#Online Strategy>`_ and run them dynamically. With the change of time, the decisive models will be also changed. In this module, we call those contributing models `online` models. In every ...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/workflow/online/strategy.py
qlib/workflow/online/strategy.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ OnlineStrategy module is an element of online serving. """ from typing import List, Union from qlib.log import get_module_logger from qlib.model.ens.group import RollingGroup from qlib.utils import transform_end_date from qlib.workflow.onlin...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/strategy/__init__.py
qlib/strategy/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License.
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
microsoft/qlib
https://github.com/microsoft/qlib/blob/477160e4ac3b4273ae0d4007982ae794a91d9f47/qlib/strategy/base.py
qlib/strategy/base.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import annotations from abc import ABCMeta, abstractmethod from typing import Any, Generator, Optional, TYPE_CHECKING, Union if TYPE_CHECKING: from qlib.backtest.exchange import Exchange from qlib.backtest.position import...
python
MIT
477160e4ac3b4273ae0d4007982ae794a91d9f47
2026-01-04T14:42:12.012974Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/main.py
main.py
import uvicorn from loguru import logger from app.config import config if __name__ == "__main__": logger.info( "start server, docs: http://127.0.0.1:" + str(config.listen_port) + "/docs" ) uvicorn.run( app="app.asgi:app", host=config.listen_host, port=config.listen_port, ...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/router.py
app/router.py
"""Application configuration - root APIRouter. Defines all FastAPI application endpoints. Resources: 1. https://fastapi.tiangolo.com/tutorial/bigger-applications """ from fastapi import APIRouter from app.controllers.v1 import llm, video root_api_router = APIRouter() # v1 root_api_router.include_router(video....
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/asgi.py
app/asgi.py
"""Application implementation - ASGI.""" import os from fastapi import FastAPI, Request from fastapi.exceptions import RequestValidationError from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse from fastapi.staticfiles import StaticFiles from loguru import logger from app.co...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/__init__.py
app/__init__.py
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/voice.py
app/services/voice.py
import asyncio import os import re from datetime import datetime from typing import Union from xml.sax.saxutils import unescape import edge_tts import requests from edge_tts import SubMaker, submaker from edge_tts.submaker import mktimestamp from loguru import logger from moviepy.video.tools import subtitles from movi...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
true
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/state.py
app/services/state.py
import ast from abc import ABC, abstractmethod from app.config import config from app.models import const # Base class for state management class BaseState(ABC): @abstractmethod def update_task(self, task_id: str, state: int, progress: int = 0, **kwargs): pass @abstractmethod def get_task(se...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/llm.py
app/services/llm.py
import json import logging import re import requests from typing import List import g4f from loguru import logger from openai import AzureOpenAI, OpenAI from openai.types.chat import ChatCompletion from app.config import config _max_retries = 5 def _generate_response(prompt: str) -> str: try: content =...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/task.py
app/services/task.py
import math import os.path import re from os import path from loguru import logger from app.config import config from app.models import const from app.models.schema import VideoConcatMode, VideoParams from app.services import llm, material, subtitle, video, voice from app.services import state as sm from app.utils im...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/subtitle.py
app/services/subtitle.py
import json import os.path import re from timeit import default_timer as timer try: from faster_whisper import WhisperModel except ImportError: WhisperModel = None from loguru import logger from app.config import config from app.utils import utils model_size = config.whisper.get("model_size", "large-v3") dev...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/material.py
app/services/material.py
import os import random from typing import List from urllib.parse import urlencode import requests from loguru import logger from moviepy.video.io.VideoFileClip import VideoFileClip from app.config import config from app.models.schema import MaterialInfo, VideoAspect, VideoConcatMode from app.utils import utils requ...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/__init__.py
app/services/__init__.py
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/video.py
app/services/video.py
import glob import itertools import os import random import gc import shutil from typing import List from loguru import logger from moviepy import ( AudioFileClip, ColorClip, CompositeAudioClip, CompositeVideoClip, ImageClip, TextClip, VideoFileClip, afx, concatenate_videoclips, ) fr...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/services/utils/video_effects.py
app/services/utils/video_effects.py
from moviepy import Clip, vfx # FadeIn def fadein_transition(clip: Clip, t: float) -> Clip: return clip.with_effects([vfx.FadeIn(t)]) # FadeOut def fadeout_transition(clip: Clip, t: float) -> Clip: return clip.with_effects([vfx.FadeOut(t)]) # SlideIn def slidein_transition(clip: Clip, t: float, side: str)...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/ping.py
app/controllers/ping.py
from fastapi import APIRouter, Request router = APIRouter() @router.get( "/ping", tags=["Health Check"], description="检查服务可用性", response_description="pong", ) def ping(request: Request) -> str: return "pong"
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/base.py
app/controllers/base.py
from uuid import uuid4 from fastapi import Request from app.config import config from app.models.exception import HttpException def get_task_id(request: Request): task_id = request.headers.get("x-task-id") if not task_id: task_id = uuid4() return str(task_id) def get_api_key(request: Request):...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/v1/llm.py
app/controllers/v1/llm.py
from fastapi import Request from app.controllers.v1.base import new_router from app.models.schema import ( VideoScriptRequest, VideoScriptResponse, VideoTermsRequest, VideoTermsResponse, ) from app.services import llm from app.utils import utils # authentication dependency # router = new_router(depend...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/v1/video.py
app/controllers/v1/video.py
import glob import os import pathlib import shutil from typing import Union from fastapi import BackgroundTasks, Depends, Path, Request, UploadFile from fastapi.params import File from fastapi.responses import FileResponse, StreamingResponse from loguru import logger from app.config import config from app.controllers...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/v1/base.py
app/controllers/v1/base.py
from fastapi import APIRouter def new_router(dependencies=None): router = APIRouter() router.tags = ["V1"] router.prefix = "/api/v1" # 将认证依赖项应用于所有路由 if dependencies: router.dependencies = dependencies return router
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/manager/redis_manager.py
app/controllers/manager/redis_manager.py
import json from typing import Dict import redis from app.controllers.manager.base_manager import TaskManager from app.models.schema import VideoParams from app.services import task as tm FUNC_MAP = { "start": tm.start, # 'start_test': tm.start_test } class RedisTaskManager(TaskManager): def __init__(s...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/manager/base_manager.py
app/controllers/manager/base_manager.py
import threading from typing import Any, Callable, Dict class TaskManager: def __init__(self, max_concurrent_tasks: int): self.max_concurrent_tasks = max_concurrent_tasks self.current_tasks = 0 self.lock = threading.Lock() self.queue = self.create_queue() def create_queue(self...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/controllers/manager/memory_manager.py
app/controllers/manager/memory_manager.py
from queue import Queue from typing import Dict from app.controllers.manager.base_manager import TaskManager class InMemoryTaskManager(TaskManager): def create_queue(self): return Queue() def enqueue(self, task: Dict): self.queue.put(task) def dequeue(self): return self.queue.ge...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/models/exception.py
app/models/exception.py
import traceback from typing import Any from loguru import logger class HttpException(Exception): def __init__( self, task_id: str, status_code: int, message: str = "", data: Any = None ): self.message = message self.status_code = status_code self.data = data # Retriev...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/models/schema.py
app/models/schema.py
import warnings from enum import Enum from typing import Any, List, Optional, Union import pydantic from pydantic import BaseModel # 忽略 Pydantic 的特定警告 warnings.filterwarnings( "ignore", category=UserWarning, message="Field name.*shadows an attribute in parent.*", ) class VideoConcatMode(str, Enum): ...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/models/const.py
app/models/const.py
PUNCTUATIONS = [ "?", ",", ".", "、", ";", ":", "!", "…", "?", ",", "。", "、", ";", ":", "!", "...", ] TASK_STATE_FAILED = -1 TASK_STATE_COMPLETE = 1 TASK_STATE_PROCESSING = 4 FILE_TYPE_VIDEOS = ["mp4", "mov", "mkv", "webm"] FILE_TYPE_IMAGES = ["jpg", "jpe...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/models/__init__.py
app/models/__init__.py
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/utils/utils.py
app/utils/utils.py
import json import locale import os from pathlib import Path import threading from typing import Any from uuid import uuid4 import urllib3 from loguru import logger from app.models import const urllib3.disable_warnings() def get_response(status: int, data: Any = None, message: str = ""): obj = { "statu...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/config/config.py
app/config/config.py
import os import shutil import socket import toml from loguru import logger root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) config_file = f"{root_dir}/config.toml" def load_config(): # fix: IsADirectoryError: [Errno 21] Is a directory: '/MoneyPrinterTurbo/config.toml' ...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/app/config/__init__.py
app/config/__init__.py
import os import sys from loguru import logger from app.config import config from app.utils import utils def __init_logger(): # _log_file = utils.storage_dir("logs/server.log") _lvl = config.log_level root_dir = os.path.dirname( os.path.dirname(os.path.dirname(os.path.realpath(__file__))) ) ...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/test/__init__.py
test/__init__.py
# Unit test package for test
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/test/services/test_voice.py
test/services/test_voice.py
import asyncio import unittest import os import sys from pathlib import Path # add project root to python path sys.path.insert(0, str(Path(__file__).parent.parent.parent)) from app.utils import utils from app.services import voice as vs temp_dir = utils.storage_dir("temp") text_en = """ What is the meaning of life?...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/test/services/test_task.py
test/services/test_task.py
import unittest import os import sys from pathlib import Path # add project root to python path sys.path.insert(0, str(Path(__file__).parent.parent.parent)) from app.services import task as tm from app.models.schema import MaterialInfo, VideoParams resources_dir = os.path.join(os.path.dirname(os.path.dirname(__file_...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/test/services/test_video.py
test/services/test_video.py
import unittest import os import sys from pathlib import Path from moviepy import ( VideoFileClip, ) # add project root to python path sys.path.insert(0, str(Path(__file__).parent.parent.parent)) from app.models.schema import MaterialInfo from app.services import video as vd from app.utils import utils resources_...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/test/services/__init__.py
test/services/__init__.py
# Unit test package for services
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
false
harry0703/MoneyPrinterTurbo
https://github.com/harry0703/MoneyPrinterTurbo/blob/951460b9f16f97937afaec8076018c7b291c9a5c/webui/Main.py
webui/Main.py
import os import platform import sys from uuid import uuid4 import streamlit as st from loguru import logger # Add the root directory of the project to the system path to allow importing modules from the project root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) if root_dir not in sys.path: s...
python
MIT
951460b9f16f97937afaec8076018c7b291c9a5c
2026-01-04T14:39:32.253751Z
true
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/setup.py
setup.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 19:26 import sys from os.path import abspath, join, dirname from setuptools import find_packages, setup this_dir = abspath(dirname(__file__)) with open(join(this_dir, 'README.md'), encoding='utf-8') as file: long_description = file.read() version = {} with...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/version.py
hanlp/version.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 19:26 __version__ = '2.1.0-beta.64' """HanLP version""" class NotCompatible(Exception): pass
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/__init__.py
hanlp/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-06-13 18:05 import hanlp.common import hanlp.components import hanlp.pretrained import hanlp.utils from hanlp.version import __version__ hanlp.utils.ls_resource_in_module(hanlp.pretrained) def load(save_dir: str, verbose=None, **kwargs) -> hanlp.common.component.C...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/optimizers/__init__.py
hanlp/optimizers/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-11-11 18:44
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/optimizers/adamw/optimization.py
hanlp/optimizers/adamw/optimization.py
# Copyright 2019 The TensorFlow 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 applica...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/optimizers/adamw/__init__.py
hanlp/optimizers/adamw/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-11-11 18:44 import tensorflow as tf from hanlp.optimizers.adamw.optimization import WarmUp, AdamWeightDecay # from hanlp.optimization.adamw.optimizers_v2 import AdamW # from hanlp.optimization.adamw.utils import get_weight_decays # def create_optimizer(model, ini...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/losses/sparse_categorical_crossentropy.py
hanlp/losses/sparse_categorical_crossentropy.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-20 01:29 import tensorflow as tf from hanlp.utils.tf_util import hanlp_register @hanlp_register class SparseCategoricalCrossentropyOverNonzeroWeights(object): def __init__(self) -> None: super().__init__() self.__name__ = type(self).__name_...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/losses/__init__.py
hanlp/losses/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-20 01:28
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/__init__.py
hanlp/datasets/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-06-13 18:15
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/ctb6.py
hanlp/datasets/tokenization/ctb6.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 22:19 _CTB6_CWS_HOME = 'http://file.hankcs.com/corpus/ctb6_cws.zip' CTB6_CWS_TRAIN = _CTB6_CWS_HOME + '#train.txt' '''CTB6 training set.''' CTB6_CWS_DEV = _CTB6_CWS_HOME + '#dev.txt' '''CTB6 dev set.''' CTB6_CWS_TEST = _CTB6_CWS_HOME + '#test.txt' '''CTB6 tes...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/__init__.py
hanlp/datasets/tokenization/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-08-01 12:33
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/sighan2005/msr.py
hanlp/datasets/tokenization/sighan2005/msr.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-21 15:42 from hanlp.datasets.tokenization.sighan2005 import SIGHAN2005, make SIGHAN2005_MSR_DICT = SIGHAN2005 + "#" + "gold/msr_training_words.utf8" '''Dictionary built on trainings set.''' SIGHAN2005_MSR_TRAIN_ALL = SIGHAN2005 + "#" + "training/msr_training.utf8...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/sighan2005/cityu.py
hanlp/datasets/tokenization/sighan2005/cityu.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-21 15:42 from hanlp.datasets.tokenization.sighan2005 import SIGHAN2005, make SIGHAN2005_CITYU_DICT = SIGHAN2005 + "#" + "gold/cityu_training_words.utf8" '''Dictionary built on trainings set.''' SIGHAN2005_CITYU_TRAIN_ALL = SIGHAN2005 + "#" + "training/cityu_train...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/sighan2005/pku.py
hanlp/datasets/tokenization/sighan2005/pku.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-21 15:42 from hanlp.datasets.tokenization.sighan2005 import SIGHAN2005, make SIGHAN2005_PKU_DICT = SIGHAN2005 + "#" + "gold/pku_training_words.utf8" '''Dictionary built on trainings set.''' SIGHAN2005_PKU_TRAIN_ALL = SIGHAN2005 + "#" + "training/pku_training.utf8...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/sighan2005/__init__.py
hanlp/datasets/tokenization/sighan2005/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-21 15:42 import os from hanlp.utils.io_util import get_resource, split_file from hanlp.utils.log_util import logger SIGHAN2005 = 'http://sighan.cs.uchicago.edu/bakeoff2005/data/icwb2-data.zip' def make(train): root = get_resource(SIGHAN2005) train = os...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/sighan2005/as_.py
hanlp/datasets/tokenization/sighan2005/as_.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-21 15:42 from hanlp.datasets.tokenization.sighan2005 import SIGHAN2005, make SIGHAN2005_AS_DICT = SIGHAN2005 + "#" + "gold/as_training_words.utf8" '''Dictionary built on trainings set.''' SIGHAN2005_AS_TRAIN_ALL = SIGHAN2005 + "#" + "training/as_training.utf8" ''...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/loaders/chunking_dataset.py
hanlp/datasets/tokenization/loaders/chunking_dataset.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-06-03 18:50 from typing import Union, List, Callable from hanlp.common.dataset import TransformableDataset from hanlp.utils.io_util import get_resource from hanlp.utils.span_util import bmes_of from hanlp.utils.string_util import ispunct class ChunkingDataset(Tran...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/loaders/txt.py
hanlp/datasets/tokenization/loaders/txt.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-08-01 12:35 from typing import Union, List, Callable from hanlp.common.dataset import TransformableDataset from hanlp.utils.io_util import TimingFileIterator from hanlp.utils.span_util import words_to_bmes, words_to_bi from hanlp.utils.string_util import split_long_...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/loaders/__init__.py
hanlp/datasets/tokenization/loaders/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2021-12-28 19:06
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/loaders/multi_criteria_cws/mcws_dataset.py
hanlp/datasets/tokenization/loaders/multi_criteria_cws/mcws_dataset.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-10-21 19:11 import os from typing import Union, List, Callable, Dict, Iterable from hanlp.datasets.tokenization.loaders.txt import TextTokenizingDataset from hanlp.utils.io_util import get_resource class MultiCriteriaTextTokenizingDataset(TextTokenizingDataset): ...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/tokenization/loaders/multi_criteria_cws/__init__.py
hanlp/datasets/tokenization/loaders/multi_criteria_cws/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-08-11 20:35 _HOME = 'https://github.com/hankcs/multi-criteria-cws/archive/naive-mix.zip#data/raw/' CNC_TRAIN_ALL = _HOME + 'cnc/train-all.txt' CNC_TRAIN = _HOME + 'cnc/train.txt' CNC_DEV = _HOME + 'cnc/dev.txt' CNC_TEST = _HOME + 'cnc/test.txt' CTB_TRAIN_ALL = _HO...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/qa/hotpotqa.py
hanlp/datasets/qa/hotpotqa.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-03-20 19:46 from enum import Enum, auto import torch import ujson from torch.nn.utils.rnn import pad_sequence from hanlp.common.dataset import TransformableDataset from hanlp_common.util import merge_list_of_dict HOTPOT_QA_TRAIN = 'http://curtis.ml.cmu.edu/dataset...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/qa/__init__.py
hanlp/datasets/qa/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-03-20 19:17
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/amr.py
hanlp/datasets/parsing/amr.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-08-18 17:47 from collections import defaultdict from copy import copy from typing import List import numpy as np import torch from hanlp_common.constant import CLS from hanlp.common.dataset import TransformableDataset, PadSequenceDataLoader from hanlp.common.trans...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/ctb5.py
hanlp/datasets/parsing/ctb5.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 18:44 from hanlp_common.constant import HANLP_URL _CTB_HOME = HANLP_URL + 'embeddings/SUDA-LA-CIP_20200109_021624.zip#' _CTB5_DEP_HOME = _CTB_HOME + 'BPNN/data/ctb5/' CTB5_DEP_TRAIN = _CTB5_DEP_HOME + 'train.conll' '''Training set for ctb5 dependency parsing...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/semeval15.py
hanlp/datasets/parsing/semeval15.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-07-28 14:40 # from hanlp.datasets.parsing.conll_dataset import CoNLLParsingDataset # # # class SemEval15Dataset(CoNLLParsingDataset): # def load_file(self, filepath: str): # pass import warnings from hanlp_common.constant import ROOT, PAD from hanlp_comm...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/pmt1.py
hanlp/datasets/parsing/pmt1.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2022-02-15 04:14 import os.path from hanlp.utils.io_util import get_resource from hanlp.utils.log_util import cprint from hanlp_common.conll import CoNLLSentence, CoNLLWord _HOME = 'https://github.com/qiulikun/PKUMultiviewTreebank/archive/refs/heads/master.zip' PTM_V1_R...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/ctb9.py
hanlp/datasets/parsing/ctb9.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-10-14 20:54 from urllib.error import HTTPError from hanlp.datasets.parsing.loaders._ctb_utils import make_ctb from hanlp.utils.io_util import get_resource, path_from_url _CTB9_HOME = 'https://catalog.ldc.upenn.edu/LDC2016T13/ctb9.0_LDC2016T13.tgz#data/' CTB9_CWS_T...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/ptb.py
hanlp/datasets/parsing/ptb.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-02-17 15:46 _PTB_HOME = 'https://github.com/KhalilMrini/LAL-Parser/archive/master.zip#data/' PTB_TRAIN = _PTB_HOME + '02-21.10way.clean' '''Training set of PTB without empty categories. PoS tags are automatically predicted using 10-fold jackknifing (:cite:`collins...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/__init__.py
hanlp/datasets/parsing/__init__.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 00:51
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false
hankcs/HanLP
https://github.com/hankcs/HanLP/blob/ddb1299bddff079e447af52ec12549c50636bfa8/hanlp/datasets/parsing/ctb8.py
hanlp/datasets/parsing/ctb8.py
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-10-14 20:54 from hanlp.datasets.parsing.loaders._ctb_utils import make_ctb _CTB8_HOME = 'https://wakespace.lib.wfu.edu/bitstream/handle/10339/39379/LDC2013T21.tgz#data/' CTB8_CWS_TRAIN = _CTB8_HOME + 'tasks/cws/train.txt' '''Training set for ctb8 Chinese word segm...
python
Apache-2.0
ddb1299bddff079e447af52ec12549c50636bfa8
2026-01-04T14:42:01.948856Z
false